Skip to content

Add model observation inference attributes - #261

Merged
Pujarini Mohapatra (biswapm) merged 5 commits into
mainfrom
users/pmohapatra/model-observation-schema
Oct 19, 2026
Merged

Pujarini Mohapatra (biswapm) merged 5 commits into
mainfrom
users/pmohapatra/model-observation-schema

Conversation

@biswapm

Copy link
Copy Markdown
Collaborator

Summary

Adds the privacy-safe OpenTelemetry attributes required by the Model Observation pipeline.

  • Capture gen_ai.response.model when the provider returns the canonical served model.
  • Capture gen_ai.usage.cache_read.input_tokens.
  • Capture gen_ai.usage.cache_write.input_tokens.
  • Normalize the inference gen_ai.operation.name value to lowercase OTel values, including chat.
  • Capture model endpoint information as server.address and an optional numeric server.port.
  • Support attributes supplied when the inference scope starts or recorded later when the response becomes available.
  • Add focused tests covering the emitted attribute names and value types.

Validation

The repository’s targeted inference tests, build, formatting, and linting checks pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Multiword operation names become unrecognized and are dropped by the exporter; late-recording tests and the changelog also need completion.

3 open findings
What changed in this PR

Adds model-observation attributes to manual inference telemetry.

Changes:

  • Records response models and cache token counts.
  • Normalizes inference operation names.
  • Adds semantic-convention constants and focused tests.
File Description
src/​a365/​contracts.ts Extends inference details with response fields.
src/​a365/​scopes/​InferenceScope.ts Emits new attributes and adds late-recording methods.
src/​genai/​semconv.ts Defines cache token attribute constants.
test/​internal/​unit/​a365/​scopes.test.ts Tests new inference attributes and methods.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/a365/contracts.ts Resolved
Comment thread src/a365/scopes/InferenceScope.ts Resolved
Comment thread test/internal/unit/a365/scopes.test.ts Resolved
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 13, 2026 10:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The documented operation allowlist omits the newly recognized canonical values.

1 open finding
3 resolved since last review

🧠 Review effort: Balanced

Comment thread src/a365/exporter/utils.ts Resolved
Add the two missing canonical operation values to the baggage
enrichment allowlist documentation so it matches GEN_AI_OPERATION_NAMES.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 15, 2026 09:26
@biswapm

Copy link
Copy Markdown
Collaborator Author

Fixed in ae0c7c6: added \ ext_completion\ and \generate_content\ to the documented baggage-enrichment allowlist in A365_DOCUMENTATION.md so it matches \GEN_AI_OPERATION_NAMES.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are focused, include relevant regression tests, and have no identified blocking issues.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two points on operation-name normalization: handling unmapped runtime strings without silently dropping spans, and using the canonical operation in the span name as well as its attribute.

Comment thread src/a365/scopes/InferenceScope.ts Resolved
Comment thread src/a365/scopes/InferenceScope.ts Resolved
Accept canonical inference strings alongside enum values and resolve the operation once for both the attribute and span name. Cover all supported inputs through scope creation and export partitioning, and document the behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 19, 2026 10:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Static review found no blocking issues, and focused regression tests cover the changes, though tests were not executed during review.

No open issues 🎉

Review effort: Balanced

@biswapm
Pujarini Mohapatra (biswapm) merged commit b33cad3 into main Oct 19, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants