Skip to content

Conversation

@shellmayr
Copy link
Member

Add a new counter metric ai.cost_calculation to track AI cost calculation outcomes, enabling monitoring of SDK bugs and manual instrumentation issues.

The metric includes two tags:

  • status: calculation_positive, calculation_negative, or calculation_failed
  • origin: SDK name (from cardinality-protected list) or "manual" for manual instrumentation

Negative calculations indicate token misalignment where cached or reasoning tokens exceed total tokens. This allows alerting when any SDK produces incorrect token counts.

Closes TET-1675
Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

Add a new counter metric `ai.cost_calculation` to track AI cost
calculation outcomes, enabling monitoring of SDK bugs and manual
instrumentation issues.

The metric includes two tags:
- status: calculation_positive, calculation_negative, or calculation_failed
- origin: SDK name (from cardinality-protected list) or "manual" for
  manual instrumentation

Negative calculations indicate token misalignment where cached or
reasoning tokens exceed total tokens. This allows alerting when any
SDK produces incorrect token counts.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@linear
Copy link

linear bot commented Jan 14, 2026

shellmayr and others added 5 commits January 15, 2026 11:28
Add a new counter metric `ai.cost_calculation` to track AI cost
calculation outcomes, enabling monitoring of SDK bugs and manual
instrumentation issues.

The metric includes two tags:
- status: calculation_positive, calculation_negative, or calculation_failed
- origin: SDK name (from cardinality-protected list) or "manual" for
  manual instrumentation

Negative calculations indicate token misalignment where cached or
reasoning tokens exceed total tokens. This allows alerting when any
SDK produces incorrect token counts.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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