Skip to content

Integrations that call withActiveSpan on an ignored child span drop its whole subtree #25389

Open

Description

@RulaKhaled

withActiveSpan(span, cb) makes any span active, including an ignored child (ignoreSpans). Spans started inside cb then inherit its unsampled flag, so everything under it is dropped. Core's startSpan and the OTel tracer avoid this by never activating an ignored child (trace.ts:85, opentelemetry/src/tracer.ts:95), but code that calls withActiveSpan with its own span skips that check.

In server-utils only tracing-channel.ts:326, prisma/orchestrion.ts:142 and now the LangChain handler (#25364) check spanIsIgnored(span) && getRootSpan(span) !== span, each with its own copy. Callers that run code under a stored span without it include ai/flue/index.ts:70,74, vercel-ai-orchestrion-subscriber.ts:499,621, ai/pi-durable/index.ts:242, ai/typesafe/index.ts:154, graphql/resolvers.ts:129 and kafkajs/consumer.ts:53,79. With an ignoreSpans rule matching e.g. execute_tool, the model call made inside a Flue tool would be lost. Found by reading the code, not reproduced yet.

Proposed fix: one exported core helper that runs cb under the span unless it is an ignored child (prisma's runUnderSpan already does this), and move these callers to it.

🤖 Generated with Claude Code

Activity

  1. self-assigned this
    on Oct 15, 2026
  2. linear-code commented on Oct 15, 2026

    @linear-code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugSpansjavascriptPull requests that update javascript code

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions