Skip to content

Commit 00d7800

Browse files
authored
fix(dashboard): reject MRI queries with actionable tracemetrics guidance (#601)
## Summary - Detect MRI (Metric Resource Identifier) syntax in `--query` arguments and reject with a `ValidationError` that suggests the correct `--dataset tracemetrics` format - Port of Sentry's canonical Python MRI parser regex from `sentry/snuba/metrics/naming_layer/mri.py` ## Problem MRI-style queries like `avg(g:custom/node.runtime.mem.rss@byte)` with `--dataset metrics` passed CLI validation (since "avg" is a valid function name) but produced widgets that render as "Internal Error" in the Sentry dashboard UI. ## Solution Added `parseMri()` and `rejectMriQueries()` to the aggregate validation pipeline in `src/types/dashboard.ts`. When MRI syntax is detected, the error message includes: - The equivalent tracemetrics query format: `avg(value,node.runtime.mem.rss,gauge,byte)` - A prompt to switch to `--dataset tracemetrics` if not already using it Example error: ``` MRI query syntax is not supported for dashboard widgets: "avg(g:custom/node.runtime.mem.rss@byte)". Use the tracemetrics query format instead: --query 'avg(value,node.runtime.mem.rss,gauge,byte)' Use --dataset tracemetrics instead of --dataset metrics. Tracemetrics format: fn(value,<metric_name>,<type>,<unit>) ``` Closes #539
1 parent 6c7223a commit 00d7800

4 files changed

Lines changed: 352 additions & 59 deletions

File tree

0 commit comments

Comments
 (0)