Repository navigation
Add model observation inference attributes - #289
Pujarini Mohapatra (biswapm) wants to merge 6 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Performance comparisonThreshold: regressions >15.0% on gating scenarios fail the build. Higher ops/s is better; positive Δ means the PR is slower.
|
There was a problem hiding this comment.
🟡 Changes recommended
Non-chat operation names are normalized to invalid values without underscores.
1 open finding
What changed in this PR
Adds model-observation attributes to A365 inference spans.
Changes:
- Records response-model and cache-token attributes at startup or later.
- Emits numeric endpoint ports.
- Normalizes inference operation names and adds focused tests.
| File | Description |
|---|---|
tests/a365/test_inference_scope.py |
Tests new inference attributes. |
src/microsoft/opentelemetry/a365/core/inference_scope.py |
Emits and updates model-observation attributes. |
src/microsoft/opentelemetry/a365/core/inference_call_details.py |
Adds response and cache-token fields. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Build activity_name from the same normalized operation name used for gen_ai.operation.name so span names use the canonical lowercase OTel value (e.g. 'text_completion gpt-4o') instead of the legacy enum value. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Fixed in bc8a5eb: \�ctivity_name\ now builds from the same normalized operation name used for \gen_ai.operation.name, so span names use canonical values (e.g. \ ext_completion gpt-4o). Added a span-name assertion to the canonical-operation-names test. |
GEN_AI_PROCESSOR_OPERATION_NAMES previously only contained legacy PascalCase InferenceOperationType.value spellings (e.g. 'TextCompletion'), so span names using the canonical lowercase form (e.g. 'text_completion gpt-4o', emitted by InferenceScope since the earlier activity-name fix) were not recognized by _operation_name_from_span_name. This caused such spans to fall through to inherited gen_ai.operation.name baggage (e.g. 'invoke_agent'), incorrectly copying invoke_agent-only attributes (caller agent identity, server.address/port) onto inference spans. Add the canonical lowercase spellings to the frozenset alongside the legacy ones, and add a regression test exercising inherited invoke_agent baggage with a canonical inference span name.
|
Fixed in bba0434: Added a regression test ( est_canonical_inference_span_name_does_not_inherit_invoke_agent_baggage) covering chat/ ext_completion/generate_content span names with inherited invoke_agent baggage, verifying common identity attributes are still enriched while invoke_agent-only attributes are withheld. Full suite: 604 passed, 25 skipped. |
Nikhil Navakiran (nikhilNava)
left a comment
There was a problem hiding this comment.
Reviewed canonical operation normalization, span-name consistency, response/cache attributes, numeric endpoint ports, and regression coverage. No blocking findings for supported inputs.

Summary
Adds the privacy-safe OpenTelemetry attributes required by the Model Observation pipeline.
gen_ai.response.modelwhen the provider returns the canonical served model.gen_ai.usage.cache_read.input_tokens.gen_ai.usage.cache_write.input_tokens.gen_ai.operation.namevalue to lowercase OTel values, includingchat.server.addressand an optional numericserver.port.Validation
The repository’s targeted inference tests, build, formatting, and linting checks pass.