InferenceOperationType.value casing inconsistent with OTel GenAI semantic conventions

未关闭 适合新手
#249 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
python

调研方向

从 libraries/microsoft-agents-a365-observability-core/microsoft_agents_a365/observability/core/inference_operation_type.py 开始,跟踪其值如何通过 InferenceScope 到达 gen_ai.operation.name。比较 Agent365-Samples PR #288 中描述的手动和自动 instrumentation 入口点。完成的标准是:手动 instrumentation 发出的操作名称与自动 instrumentation 发出的相同且均为小写,同时考虑兼容性影响。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
Python
星标
41
派生
23
平均合并
7 小时 43 分钟
30 天内合并 PR
3

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/Agent365-python 的其他 Issue

查看 microsoft/Agent365-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。