Skip to content

fix(bedrock): emit prompt-caching counter as gen_ai.prompt_caching - #33

Merged
sayonfortify merged 2 commits into
fr-v0.52.6.xfrom
fix/bedrock-prompt-caching-canonical-name
Jun 18, 2026
Merged

fix(bedrock): emit prompt-caching counter as gen_ai.prompt_caching#33
sayonfortify merged 2 commits into
fr-v0.52.6.xfrom
fix/bedrock-prompt-caching-canonical-name

Conversation

@sayonfortify

Copy link
Copy Markdown

Summary

  • Change the Bedrock prompt-caching counter name from gen_ai.prompt.caching to the canonical contract name gen_ai.prompt_caching.
  • Add a deterministic test asserting the counter name matches CacheSpanAttrs.CACHED and 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.py
  • AST assertion over actual source:
    • PromptCaching.LLM_BEDROCK_PROMPT_CACHING == "gen_ai.prompt_caching"
    • CacheSpanAttrs.CACHED == "gen_ai.prompt_caching"
  • git diff --check

Local limitation:

  • pytest packages/opentelemetry-instrumentation-bedrock/tests/metrics/test_bedrock_prompt_caching_metrics.py -q is blocked in this checkout by missing boto3 from 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:

  1. Tag the fork as fr-v0.52.6.22.
  2. Run ocelle-py/scripts/vendor.sh ../fr-openllmetry-py . fr-v0.52.6.22.
  3. Review src/fortifyroot/_vendor/ and VENDOR_MANIFEST.json.
  4. Open the ocelle-py vendoring PR.

No PyPI/RC release is included here.

@sayonfortify
sayonfortify merged commit 976d42a into fr-v0.52.6.x Jun 18, 2026
10 checks passed
@sayonfortify
sayonfortify deleted the fix/bedrock-prompt-caching-canonical-name branch June 18, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant