Skip to content

Decide and align chat and agent telemetry attribute shapes #109

Closed

Description

@shibayan

Summary

Three telemetry workstreams affect cross-language dashboard compatibility. They are not all straight Python-parity fixes and must be resolved independently.

1. gen_ai.response.finish_reasons

TypeScript emits a native OTel string array and normalizes tool_calls to tool_call. Pinned Python emits a JSON-encoded string containing raw values. Go does not emit the attribute, and the relevant .NET/Microsoft.Extensions.AI value must be measured before choosing a cross-language representation.

Decision: align with a measured reference representation or retain the semconv-oriented TypeScript shape and document the difference. Apply one choice consistently to chat and invoke_agent spans.

2. gen_ai.input.messages / gen_ai.output.messages

TypeScript reduces non-text parts to { type } and does not stamp the final output part with its finish reason. Python emits richer tool-call, tool-result, reasoning, URI, blob, and generic part shapes. Decide whether to align or retain the compact representation for privacy/size reasons.

3. Endpoint attributes

Pinned Python generates server.address from service_url (falling back to "unknown"). It does not generate server.port; that key appears only in its metric allowlist. TypeScript currently generates neither, although both keys are listed in its metric allowlist.

  • Implement server.address consistently for chat spans and chat-token/duration metrics.
  • Treat server.port as a separate .NET/semconv decision. Do not cite Python parity as its implementation reason.

Acceptance criteria

  • The exact type/value decision for finish_reasons, rich/compact message parts, and server.port is recorded separately with measured/reference evidence.
  • finish_reasons has exact-value tests for awaited/streamed chat and invoke_agent spans.
  • If rich message parts are adopted, tests cover text, function call, function result, reasoning, URI, blob, generic content, and final finish reason.
  • If compact parts are retained, privacy/size rationale and lost fields are documented for dashboard users.
  • Sensitive-message capture disabled continues to omit message attributes.
  • server.address carries the same value on chat spans and both relevant histogram dimension sets, with a known service URL and the "unknown" fallback covered.
  • server.port presence/absence and type are pinned on spans and metrics according to the recorded decision.
  • Any change to an existing attribute's type or shape ships with a dashboard migration note; additive attributes are listed in CHANGELOG.

Activity

  1. added
    coreUsage: [Issues, PRs], Target: packages/core
    observabilityUsage: [Issues, PRs], Target: tracing, metrics, and observability
    on Aug 29, 2026
  2. added theissue type on Aug 29, 2026
  3. self-assigned this
    on Aug 29, 2026
  4. changed the title [-]Align chat and agent span attributes with the Python implementation's shapes[/-] [+]Decide and align chat and agent telemetry attribute shapes[/+] on Aug 30, 2026
  5. added a commit that references this issue on Aug 31, 2026
    2578d10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

coreUsage: [Issues, PRs], Target: packages/coreobservabilityUsage: [Issues, PRs], Target: tracing, metrics, and observability

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions