Skip to content

Conversation

@chargome
Copy link
Member

  • Adds a new entry to sdk/telemetry for metrics.
  • Adds a new entry to /sdk/data-model/envelope-items/ for the trace metric item

Took the logs specs as a template.

ref getsentry/sentry-javascript#17883

@chargome chargome self-assigned this Oct 10, 2025
@vercel
Copy link

vercel bot commented Oct 10, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
develop-docs Ready Ready Preview Comment Nov 12, 2025 1:55pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
sentry-docs Ignored Ignored Preview Nov 12, 2025 1:55pm

@chargome chargome changed the title docs(dev-docs): Add metrics docs docs(dev-docs): Add metrics telemetry specs Oct 10, 2025
Comment on lines +79 to +85
: **Number, required**. The numeric value of the metric. The interpretation depends on the metric `type`:

- For `counter` metrics: the count to increment by (should default to 1)
- For `gauge` metrics: the current value
- For `distribution` metrics: a single measured value

Integers should be a 64-bit signed integer, while doubles should be a 64-bit floating point number.
Copy link
Member

Choose a reason for hiding this comment

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

Can you supply both an integer and a float to a metric? So call increment(3) and then increment(4.5)?

Copy link
Member

Choose a reason for hiding this comment

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

I suggest we stick to integers for counters. @k-fish I assume the value eventually ends up in an EAP attribute where integers and floats go into separate columns. Mixing both types might then make queries tricky, plus you'd have to deal with precision loss for very large numbers.

Copy link
Contributor

Choose a reason for hiding this comment

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

Tagging on to the discussion, is the SDK expected to truncate large integers? If so, how do we truncate, or do we just reject integers that are beyond 64 bits.

In particular, 64-bit floats are natural in Python, but integers are arbitrary precision (under the hood more memory is allocated if the user provides a large integer).

- `name` **String, required**: The name of the metric
- `value` **Number, required**: The value of the metric
- `options` **Object, optional**: An object containing the following properties:
- `unit` **String, optional**: The unit of measurement (distribution and gauge only)
Copy link
Member

Choose a reason for hiding this comment

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

Why can't we put units on counts?

Copy link
Member Author

Choose a reason for hiding this comment

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

Isn't count the unit itself?

Copy link
Member

Choose a reason for hiding this comment

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

No, you can count 🥔 for example 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah but that would be determined by the name right? metrics.count('🥔', 2)?

Copy link
Member

@k-fish k-fish left a comment

Choose a reason for hiding this comment

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

Thanks for this @chargome 👍

A couple notes:

  • This api might change before a beta takes place, so we may want to leave it up in PR for a while
  • Metrics may have different limits than logs (eg. metric size limit is 2kib currently, might lower it) so may want to make note of that when it comes to adding attributes. We also probably need indicate what the failure mode should be if you have too much attribute data on the scope that you're trying to add to each metric

Copy link
Contributor

@coolguyzone coolguyzone left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines +79 to +85
: **Number, required**. The numeric value of the metric. The interpretation depends on the metric `type`:

- For `counter` metrics: the count to increment by (should default to 1)
- For `gauge` metrics: the current value
- For `distribution` metrics: a single measured value

Integers should be a 64-bit signed integer, while doubles should be a 64-bit floating point number.
Copy link
Contributor

Choose a reason for hiding this comment

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

Tagging on to the discussion, is the SDK expected to truncate large integers? If so, how do we truncate, or do we just reject integers that are beyond 64 bits.

In particular, 64-bit floats are natural in Python, but integers are arbitrary precision (under the hood more memory is allocated if the user provides a large integer).

cursor[bot]

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Oct 31, 2025

Bundle Report

Changes will increase total bundle size by 308.4kB (1.33%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-client-array-push 10.17MB -6 bytes (-0.0%) ⬇️
sentry-docs-server-cjs 12.93MB 308.41kB (2.44%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: sentry-docs-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/chunks/pages/_app-*.js -3 bytes 882.71kB -0.0%
static/chunks/8321-*.js -3 bytes 425.87kB -0.0%
server/middleware-*.js -6.46kB 1.0kB -86.59%
server/middleware-*.js 6.46kB 7.46kB 645.5% ⚠️
static/ZyUPqYCxhLA1HtDzRz6LS/_buildManifest.js (New) 684 bytes 684 bytes 100.0% 🚀
static/ZyUPqYCxhLA1HtDzRz6LS/_ssgManifest.js (New) 77 bytes 77 bytes 100.0% 🚀
static/VErFD59qyha5NgN0j9rKT/_buildManifest.js (Deleted) -684 bytes 0 bytes -100.0% 🗑️
static/VErFD59qyha5NgN0j9rKT/_ssgManifest.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️
view changes for bundle: sentry-docs-server-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
1729.js -3 bytes 1.74MB -0.0%
../instrumentation.js -3 bytes 1.07MB -0.0%
9523.js -3 bytes 1.04MB -0.0%
../app/[[...path]]/page.js.nft.json 102.81kB 870.88kB 13.38% ⚠️
../app/platform-redirect/page.js.nft.json 102.81kB 870.79kB 13.39% ⚠️
../app/sitemap.xml/route.js.nft.json 102.81kB 868.02kB 13.43% ⚠️

@chargome chargome merged commit 0126b1f into master Nov 13, 2025
13 checks passed
@chargome chargome deleted the cg-dev-docs-metrics branch November 13, 2025 08:14
@github-actions github-actions bot locked and limited conversation to collaborators Nov 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants