🐛 Bug Report: Incomplete cache token migration after #4243 breaks Bedrock and Groq instrumentation
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 76/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
issueで挙げられているBedrockとGroqのspan_utils.pyファイルから始め、次にリポジトリ内で削除された2つのキャッシュトークン定数を検索し、現在のGenAIAttributesの定義を確認してください。プロンプトキャッシュのテストと、レポートに記載されているGroqのspan-utilsテストを実行してください。キャッシュ使用量が正常に記録され、残っている実行時およびテストの参照がworkspaceのsemantic-conventionsソースに対して失敗しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Which component is this bug for?
Bedrock Instrumentation
📜 Description
The semantic-convention migration in #4243 removed the following attributes from SpanAttributes:
SpanAttributes.GEN_AI_USAGE_CACHE_READ_INPUT_TOKENSSpanAttributes.GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS
However, the Bedrock and Groq instrumentations still reference these attributes in runtime code.
When a response contains prompt-cache usage data, accessing the removed attributes raises AttributeError. Several tests in Bedrock, Groq, Google Generative AI, and Mistral AI also continue to reference the removed attributes.
This appears to be an incomplete migration from SpanAttributes to GenAIAttributes.
👟 Reproduction steps
- Clone the repository and enter the Bedrock instrumentation package:
cd packages/opentelemetry-instrumentation-bedrock
2.Run the prompt-caching test using the workspace version of opentelemetry-semantic-conventions-ai:
uv run --group test python -c "import sys; sys.path.insert(0, '../opentelemetry-semantic-conventions-ai'); import pytest; sys.exit(pytest.main(['tests/traces/test_prompt_caching.py']))"
3.Alternatively, verify directly that the attributes are absent:
```python
from opentelemetry.semconv_ai import SpanAttributes
print(
hasattr(
SpanAttributes,
"GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS",
)
)
# False
print(
hasattr(
SpanAttributes,
"GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS",
)
)
# False
4.Bedrock still accesses the missing attributes inside converse_usage_record():
SpanAttributes.GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS
SpanAttributes.GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS
5.When cache usage is present, Python raises an AttributeError.
👍 Expected behavior
Bedrock and Groq should record prompt-cache token usage without raising an exception. All remaining references should use the current `GenAIAttributes` constants, or compatible aliases should remain available on `SpanAttributes` during the migration.
### 👎 Actual Behavior with Screenshots
When a cache-token code path accesses the removed constant, Python raises:
```text
AttributeError: type object 'SpanAttributes' has no attribute 'GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS'
The Bedrock prompt-caching test also fails when run against the current workspace version of opentelemetry-semantic-conventions-ai:
```text
FAILED tests/traces/test_prompt_caching.py::test_invoke_model_cache_tokens
The Groq span-utils suite produces six failures involving the same missing cache-read attribute.
🤖 Python Version
3.13.7
📃 Provide any additional context for the Bug.
I traced the regression to #4243.
That migration moved the cache-token constants to GenAIAttributes and removed them from SpanAttributes. Several packages were migrated, but remaining runtime references in Bedrock and Groq were not updated.
The issue can be masked when package-specific environments resolve the previously published opentelemetry-semantic-conventions-ai==0.5.1, where the attributes are still available. Running the tests against the current workspace semantic-conventions source exposes the regression.
Relevant runtime locations include:
packages/opentelemetry-instrumentation-bedrock/opentelemetry/instrumentation/bedrock/span_utils.pypackages/opentelemetry-instrumentation-groq/opentelemetry/instrumentation/groq/span_utils.py
A possible fix is to migrate the remaining runtime and test references to GenAIAttributes. Alternatively, compatibility aliases could be restored on SpanAttributes if backward compatibility is intended.
I searched the repository history and existing reports but did not find a later fix for these remaining references. I am willing to submit a PR.
👀 Have you spent some time to check if this bug has been raised before?
- I checked and didn't find similar issue
Are you willing to submit PR?
Yes I am willing to submit a PR!
- 主要言語
- Python
- スター
- 7.5k
- フォーク
- 1.2k
- 平均マージ
- 2日 6時間
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
traceloop/openllmetry のほかの issue
-
bug python
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
traceloop/openllmetry#4717 ·
メンテナーはふだん 1 日以内に返信
-
🐛 Bug Report: OpenAI instrumentation drops gen_ai.usage.reasoning_tokens on streamed chat completions対応中かも @jayfeng7 が 23 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
traceloop/openllmetry#4660 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Bug Report: Failed dataset deletes still remove local rows and columns対応中かも @inchang-ing が 32 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
traceloop/openllmetry#4630 ·
メンテナーはふだん 1 日以内に返信
-
🐛 Bug Report: LiteLLM instrumentation does not record seed, stop, frequency_penalty, presence_penalty対応中かも @shantam77 が 38 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
traceloop/openllmetry#4598 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
🐛 Bug Report: LiteLLM instrumentation never ends the span when a call is interrupted (KeyboardInterrupt, asyncio cancellation)対応中かも @rupak-eng が 39 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
traceloop/openllmetry#4597 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
traceloop/openllmetry の issue をすべて見る
似ている issue
-
Internal Errorオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
frappe/frappe_docker#2071 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
The-Pocket/PocketFlow#161 ·
-
comp/desktop P2 type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NousResearch/hermes-agent#157702 ·
メンテナーはふだん 1 日以内に返信
-
scibench_physics / scibench_chemistry: a correct answer scores 0 when the unit has a power of ten対応中かも @BahaaMattar が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
EvolvingLMMs-Lab/lmms-eval#1699 ·
メンテナーはふだん 1 日以内に返信
-
project_inputs.html uses undefined file variable for dropdown IDs, lacks visual tag badges, and has empty delete labels対応中かも @Rucha0901 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
aboutcode-org/scancode.io#2354 ·
メンテナーはふだん 1 日以内に返信