Skip to content

chore: Deprecate ai.monitoring.record_token_usage() - #7918

Merged
alexander-alderman-webb merged 4 commits into
masterfrom
webb/deprecate-record-token-usage
Oct 8, 2026
Merged

alexander-alderman-webb merged 4 commits into
masterfrom
webb/deprecate-record-token-usage

Conversation

@alexander-alderman-webb

@alexander-alderman-webb alexander-alderman-webb commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Description

Deprecate the function, pending removal in the upcoming major.
Inline uses of the function in integrations.

Issues

Contributes to #6894

Reminders

@alexander-alderman-webb
alexander-alderman-webb force-pushed the webb/deprecate-record-token-usage branch from 01211f3 to 75d5882 Compare October 7, 2026 13:58
@alexander-alderman-webb
alexander-alderman-webb marked this pull request as ready for review October 7, 2026 14:01
@alexander-alderman-webb
alexander-alderman-webb requested a review from a team as a code owner October 7, 2026 14:01
@alexander-alderman-webb
alexander-alderman-webb force-pushed the webb/deprecate-record-token-usage branch from 75d5882 to 6f26527 Compare October 7, 2026 14:04
Comment thread sentry_sdk/ai/monitoring.py Outdated

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread sentry_sdk/integrations/cohere.py
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ 133451 passed | ⏭️ 7276 skipped | Total: 140727 | Pass Rate: 94.83% | Execution Time: 460m 47s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +34
Passed Tests 📈 +34
Failed Tests —
Skipped Tests —

All tests are passing successfully.

✅ Patch coverage is 85.71%. Project has 2593 uncovered lines.
❌ Project coverage is 90.26%. Comparing base (1f4ba26) to head (cb7a639).

Files with missing lines (6)
File Patch % Lines
sentry_sdk/integrations/cohere.py 66.67% ⚠️ 6 Missing and 4 partials
sentry_sdk/integrations/huggingface_hub.py 82.61% ⚠️ 4 Missing and 6 partials
sentry_sdk/integrations/litellm.py 92.31% ⚠️ 1 Missing and 4 partials
sentry_sdk/integrations/openai.py 96.15% ⚠️ 1 Missing and 3 partials
sentry_sdk/integrations/anthropic.py 100.00% ⚠️ 3 partials
sentry_sdk/ai/monitoring.py 0.00% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##        master       #PR       +/-##
==========================================
- Coverage    90.37%    90.26%    -0.11%
==========================================
  Files          202       202         —
  Lines        26552     26625       +73
  Branches      9854      9926       +72
==========================================
+ Hits         23995     24032       +37
- Misses        2557      2593       +36
- Partials      1495      1515       +20

Generated by Codecov Action

@ericapisani ericapisani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes LGTM but warden looks to be right about huggingface_hub still using record_token_usage. Is the migration away from this there happening in a follow up?

@alexander-alderman-webb
alexander-alderman-webb force-pushed the webb/deprecate-record-token-usage branch from 3a00c3d to a8818f9 Compare October 8, 2026 08:12

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread sentry_sdk/integrations/huggingface_hub.py Outdated
@alexander-alderman-webb
alexander-alderman-webb force-pushed the webb/deprecate-record-token-usage branch from a8818f9 to 8238921 Compare October 8, 2026 08:18

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8238921. Configure here.

Comment thread sentry_sdk/integrations/huggingface_hub.py Outdated
Comment thread sentry_sdk/integrations/anthropic.py
@alexander-alderman-webb
alexander-alderman-webb force-pushed the webb/deprecate-record-token-usage branch from 8238921 to cb7a639 Compare October 8, 2026 08:24
@alexander-alderman-webb
alexander-alderman-webb merged commit 7cb8094 into master Oct 8, 2026
462 of 466 checks passed
@alexander-alderman-webb
alexander-alderman-webb deleted the webb/deprecate-record-token-usage branch October 8, 2026 08:55
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.

3 participants