fix(anthropic): restore accidentally lost cache tokens attributes#3648
fix(anthropic): restore accidentally lost cache tokens attributes#3648dinmukhamedm wants to merge 1 commit intotraceloop:mainfrom
Conversation
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to daa6ff5 in 11 seconds. Click for details.
- Reviewed
459lines of code in3files - Skipped
0files when reviewing. - Skipped posting
0draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
Workflow ID: wflow_ZIhOqCTqy5KUUHF1
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
📝 WalkthroughWalkthroughThis PR restores cache-related token usage attributes in Anthropic instrumentation by renaming attribute keys from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was accidentally removed in #3138 and some subsequent changes. Restoring. More context in #3647.
Note: this PR does NOT fully close #3647, as there will be a new attribute convention soon, see open-telemetry/semantic-conventions#3163
feat(instrumentation): ...orfix(instrumentation): ....Important
Restores cache token attributes in Anthropic instrumentation and updates tests to verify correct attribute settings.
_aset_token_usage()and_set_token_usage()in__init__.pyand_set_token_usage()instreaming.py.GEN_AI_USAGE_CACHE_READ_INPUT_TOKENStoLLM_USAGE_CACHE_READ_INPUT_TOKENSandGEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENStoLLM_USAGE_CACHE_CREATION_INPUT_TOKENS.test_prompt_caching.pyto verify cache token attributes are correctly set for both sync and async operations.This description was created by
for daa6ff5. You can customize this summary. It will automatically update as commits are pushed.
Summary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.