Skip to content

feat(langchain): Record cached token usage attributes - #7132

Open
alexander-alderman-webb wants to merge 8 commits into
webb/langchain/stop-double-counting-candidate-tokensfrom
webb/langchain/more-tokens
Open

feat(langchain): Record cached token usage attributes#7132
alexander-alderman-webb wants to merge 8 commits into
webb/langchain/stop-double-counting-candidate-tokensfrom
webb/langchain/more-tokens

Conversation

@alexander-alderman-webb

@alexander-alderman-webb alexander-alderman-webb commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Description

Limit support for cached tokens counts to values in the provider agnostic UsageMetadata dictionaries.
If values are in the agnostic dictionary, prefer these for all token types.

Issues

Reminders

@alexander-alderman-webb alexander-alderman-webb changed the title feat(langchain): Record cached token usage values feat(langchain): Record cached token usage attributes Aug 7, 2026
@alexander-alderman-webb
alexander-alderman-webb marked this pull request as ready for review August 7, 2026 10:01
@alexander-alderman-webb
alexander-alderman-webb requested a review from a team as a code owner August 7, 2026 10:01
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

99182 passed | ⏭️ 6527 skipped | Total: 105709 | Pass Rate: 93.83% | Execution Time: 364m 35s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -35
Passed Tests 📉 -83
Failed Tests
Skipped Tests 📈 +48

All tests are passing successfully.

✅ Patch coverage is 97.96%. Project has 2501 uncovered lines.
✅ Project coverage is 89.99%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
sentry_sdk/integrations/langchain.py 97.78% ⚠️ 1 Missing and 2 partials
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    89.98%    89.99%    +0.01%
==========================================
  Files          193       193         —
  Lines        24975     24996       +21
  Branches      9008      9030       +22
==========================================
+ Hits         22474     22495       +21
- Misses        2501      2501         —
- Partials      1437      1440        +3

Generated by Codecov Action

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.

2 participants