Dashboard widgets: support metric equations for derived values (e.g. occurrence rate)
- Dominant language
- Python
- Stars
- 44.8k
- Forks
- 4.9k
- Avg merge
- 21h 10m
- Merged PRs (30d)
- 635
Description
## Summary
Dashboard widgets do not support computed expressions across metric queries. Users need to create derived metrics — such as `occurred / total = occurrence percentage` — directly in dashboard widgets without relying on pre-aggregated custom metrics or workarounds in alerting.
## Current behavior
Dashboard widgets support individual metric queries (e.g. count of spans matching a filter) but have no way to compose two metric values into a formula. Users who want to display a ratio or percentage must either:
* Track the derived metric externally before ingestion
* Switch to Discover/Explore (which supports equations but has limited metric querying and no persistent dashboard widget path)
* Use Metric Alerts with equations ([ISWF-1927](https://linear.app/getsentry/issue/ISWF-1927/metric-alerts-support-equationsformulas-in-metric-alerts-to-calculate)), which does not surface in dashboards
## Gap
Dashboards are the primary surface for ongoing visibility into system health. Without formula support, any ratio-based KPI (occurrence rate, error rate, success rate) cannot be expressed as a first-class widget. Users must instrument derived values at the SDK level or maintain separate pipelines, increasing toil and reducing dashboard utility.
## Options
* **Equation support in widget builder**: Allow users to define a formula referencing two or more metric queries (e.g. `a / b`, `a / (a + b) * 100`), following the model already in place for transaction-based Discover widgets. Numerator and denominator queries are configured independently; the result drives the chart/number widget.
* **Virtual/derived metric layer**: Support defining a named derived metric (formula) that can be queried like a regular metric across dashboards and alerts. Higher reuse, but significantly more infrastructure.
* **Client-side formula evaluation**: Evaluate formulas in the widget rendering layer from raw query results. Simpler to ship, no backend changes, but limited to single time-bucket granularity and no alerting integration.
## Recommendation
Extend the widget builder to support multi-query equations (option 1), consistent with existing Discover equation behavior. This provides the most direct path to the use case and aligns with [ISWF-1927](https://linear.app/getsentry/issue/ISWF-1927/metric-alerts-support-equationsformulas-in-metric-alerts-to-calculate) for alerts.
## Prior art
* Grafana, Datadog, and Honeycomb all support formula expressions across metric queries in dashboard panels as a first-class feature.
* `getsentry/sentry` [ISWF-1927](https://linear.app/getsentry/issue/ISWF-1927/metric-alerts-support-equationsformulas-in-metric-alerts-to-calculate) — same capability gap identified for Metric Alerts specifically.
Action taken on behalf of Richard Propst.
Contributor guide
Assessment
This issue has not been assessed yet.