Skip to content

InferenceOperationType.value casing inconsistent with OTel GenAI semantic conventions #249

@juliomenendez

Description

@juliomenendez

Issue

The InferenceOperationType enum in libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/inference_operation_type.py uses capitalized values (Chat, TextCompletion, GenerateContent). These values flow into gen_ai.operation.name span attributes via InferenceScope (manual instrumentation).

The OpenTelemetry GenAI semantic conventions specify lowercase for gen_ai.operation.name values (e.g., chat, text_completion, embeddings). The auto-instrumentation extension packages (e.g., microsoft-agents-a365-observability-extensions-openai) correctly emit lowercase values.

Effect

Customers using manual instrumentation see gen_ai.operation.name="Chat", customers using auto instrumentation see gen_ai.operation.name="chat" for the same operation. Backend filters and dashboards built around one casing won't match spans produced by the other.

Repro

End-to-end run of the two samples in microsoft/Agent365-Samples PR #288:

  • python/observability-with-otlp/main.py (manual instrumentation): emits gen_ai.operation.name="Chat", span name Chat gpt-4o-mini
  • python/observability-with-azure-monitor/main.py (auto-instrumentation): emits gen_ai.operation.name="chat", span name chat gpt-4.1

Suggested fix

Change InferenceOperationType values to lowercase to match the OTel spec and auto-instrumentation behavior:

```python
class InferenceOperationType(Enum):
CHAT = "chat"
TEXT_COMPLETION = "text_completion"
GENERATE_CONTENT = "generate_content"
```

This is a behavior change — backend dashboards filtering by Chat would stop matching. May need a major-version bump or a transitional period.

Related

  • PR #288 in Agent365-Samples documents the discrepancy in the sample READMEs
  • Companion docs PR (forthcoming) on Agent365-python documents it in the integration guide

🤖 Filed via Claude Code while validating samples

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