Skip to content

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

Merged
alexander-alderman-webb merged 15 commits into
masterfrom
webb/langchain/more-tokens
Aug 10, 2026
Merged

feat(langchain): Record cached token usage attributes#7132
alexander-alderman-webb merged 15 commits into
masterfrom
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

Contributes to #6799

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 📊

99560 passed | ⏭️ 6671 skipped | Total: 106231 | Pass Rate: 93.72% | Execution Time: 341m 48s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +72
Passed Tests 📈 +24
Failed Tests
Skipped Tests 📈 +48

All tests are passing successfully.

✅ Patch coverage is 97.96%. Project has 2502 uncovered lines.
✅ Project coverage is 90.02%. 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    90.02%    90.02%        —%
==========================================
  Files          193       193         —
  Lines        25020     25061       +41
  Branches      9032      9058       +26
==========================================
+ Hits         22521     22559       +38
- Misses        2499      2502        +3
- Partials      1434      1439        +5

Generated by Codecov Action

Base automatically changed from webb/langchain/stop-double-counting-candidate-tokens to master August 10, 2026 09:23
@alexander-alderman-webb
alexander-alderman-webb merged commit 6a50a0c into master Aug 10, 2026
145 checks passed
@alexander-alderman-webb
alexander-alderman-webb deleted the webb/langchain/more-tokens branch August 10, 2026 09:43
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