Skip to content

Cloudflare tracing omits join IDs from existing child spans #624

Description

@Divkix

Describe the Bug

On Cloudflare, durable work can continue in a later invocation. If the owning span is missing, child spans do not carry enough identifiers to join the fragments.

The events already have the IDs. @flue/opentelemetry projects them through identifiers(event). The Cloudflare adapter currently:

  • puts submission, instance, and conversation on agent operations, but not flue.operation.id
  • puts task id on task operations, but not submission or operation id
  • omits submission, operation, and turn ids from model and model-tool spans
  • omits submission and operation ids from caller-shell spans

This is an exporter gap, not a runtime execution bug. The IDs are present on the events; they are just not copied onto those spans.

Expected Behavior

Keep every existing span name and parent relationship. Add only these optional attributes when the event already has the value:

  • agent operation: flue.operation.id
  • task: flue.submission.id, flue.operation.id
  • model and model-tool: flue.submission.id, flue.operation.id, flue.turn.id
  • caller-shell: submission and operation ids when present

Do not add new spans, eventIndex, or attempt count. Do not copy the rest of OpenTelemetry's identifier set (harness, session, parent_session, and so on).

Steps to Reproduce

  1. Trace an agent prompt that includes a model turn and a tool call with createCloudflareTracing().
  2. Compare those span attributes with the same run under createOpenTelemetryInstrumentation().
  3. Cloudflare child spans are missing the join IDs above even though the corresponding runtime events carry submissionId, operationId, and turnId.

Relevant code: packages/runtime/src/cloudflare/tracing/index.ts (agent / task / model / tool / caller-shell attribute builders) and packages/runtime/src/cloudflare/tracing/attributes.ts (no operation or turn ID constants today). OpenTelemetry's projection is identifiers() in packages/opentelemetry/src/index.ts.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions