Dashboards: let an equation show as a percentage and set its decimal places
Author: sergicalCreated Sep 17, 2026Updated Sep 17, 2026
LabelsProduct Area: DashboardsFeature
What happens
A share is always an equation, and Sentry shows it as a raw number with all its decimals.
| Widget query | Shows | Wanted |
|---|---|---|
equation|100 * sum(gen_ai.usage.cache_read.input_tokens) / sum(gen_ai.usage.input_tokens) |
83.6758 |
83.7% |
equation|(sum(gen_ai.usage.input_tokens) - sum(gen_ai.usage.cache_read.input_tokens)) / count() (table column) |
1,635.3072 |
1,635 |
A widget has no setting for the type or the decimal places of an equation, so the only place for "%" is the widget title. Big number thresholds work on the value, but the value still shows without "%".
The prompt cache hit rate is one of the main numbers for AI agent cost, and it is a ratio of two sums.
Expected
One or both of these:
- A per-column setting on a widget query for an equation: output type (number, percentage, currency, duration) and decimal places.
a / bwhereaandbhave the same type is typed aspercentageand shows with the existingpercentagerenderer (formatPercentageinstatic/app/utils/discover/fieldRenderers.tsx), so users do not need100 *.
Plain numbers from an equation get a sensible default: at most 2 decimals, or none when the value is above 100.
Steps to reproduce
- Send spans with
gen_ai.usage.input_tokensandgen_ai.usage.cache_read.input_tokens. - Make a big number widget with
equation|100 * sum(gen_ai.usage.cache_read.input_tokens) / sum(gen_ai.usage.input_tokens). - It shows
83.6758, with no%, and there is no setting to change this.
Related
- The unit issue for currency and duration: https://github.com/getsentry/sentry/issues/124678
get_unit_and_type()insrc/sentry/api/bases/organization_events.pyreturns"number"for every equation except rates (#108043).
Source: getsentry/sentry