fix(bedrock): emit prompt-caching counter as gen_ai.prompt_caching - #33
Merged
sayonfortify merged 2 commits intoJun 18, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gen_ai.prompt.cachingto the canonical contract namegen_ai.prompt_caching.CacheSpanAttrs.CACHEDand the backend/catalog contract spelling.Why
Prometheus normalizes both spellings to
gen_ai_prompt_caching, so current Mimir visibility works. But the OTel/contract name should match exactly for registry/discovery, docs, and SDK/backend round-trips.Validation
python3 -m py_compile packages/opentelemetry-instrumentation-bedrock/opentelemetry/instrumentation/bedrock/__init__.py packages/opentelemetry-instrumentation-bedrock/tests/metrics/test_bedrock_prompt_caching_metrics.pyPromptCaching.LLM_BEDROCK_PROMPT_CACHING == "gen_ai.prompt_caching"CacheSpanAttrs.CACHED == "gen_ai.prompt_caching"git diff --checkLocal limitation:
pytest packages/opentelemetry-instrumentation-bedrock/tests/metrics/test_bedrock_prompt_caching_metrics.py -qis blocked in this checkout by missingboto3from the package test environment. CI/fork env should run this file with the package dependencies installed.Vendoring sequence
Per
internal-sop/openllmetry/VENDORING_SOP.md, do not PR the ocelle-py vendored copy directly from this untagged branch. After this merges:fr-v0.52.6.22.ocelle-py/scripts/vendor.sh ../fr-openllmetry-py . fr-v0.52.6.22.src/fortifyroot/_vendor/andVENDOR_MANIFEST.json.No PyPI/RC release is included here.