Skip to content

fix(dashboard): reject MRI queries with actionable tracemetrics guidance#601

Merged
BYK merged 1 commit intomainfrom
fix/539-mri-query-validation
Mar 30, 2026
Merged

fix(dashboard): reject MRI queries with actionable tracemetrics guidance#601
BYK merged 1 commit intomainfrom
fix/539-mri-query-validation

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Mar 30, 2026

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

MRI-style queries like `avg(g:custom/node.runtime.mem.rss@byte)` passed
validation but produced widgets rendering as "Internal Error" in the
dashboard UI. Add MRI syntax detection (ported from Sentry's canonical
Python parser) to `validateAggregateNames`, throwing a ValidationError
with the correct `--dataset tracemetrics` format suggestion.

Closes #539
@github-actions
Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (upgrade) Show changelog summary during CLI upgrade by BYK in #594

Bug Fixes 🐛

  • (dashboard) Reject MRI queries with actionable tracemetrics guidance by BYK in #601
  • (skill) Avoid unnecessary auth, reinforce auto-detection, fix field examples by BYK in #599

Internal Changes 🔧

  • Regenerate skill files and command docs by github-actions[bot] in 664362ca

🤖 This preview updates automatically when you update the PR.

@BYK BYK marked this pull request as ready for review March 30, 2026 11:07
@github-actions
Copy link
Copy Markdown
Contributor

Codecov Results 📊

129 passed | Total: 129 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 95.74%. Project has 1307 uncovered lines.
❌ Project coverage is 95.62%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/types/dashboard.ts 95.74% ⚠️ 2 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    95.63%    95.62%    -0.01%
==========================================
  Files          203       203         —
  Lines        29799     29846       +47
  Branches         0         0         —
==========================================
+ Hits         28496     28539       +43
- Misses        1303      1307        +4
- Partials         0         0         —

Generated by Codecov Action

@BYK BYK merged commit 00d7800 into main Mar 30, 2026
22 checks passed
@BYK BYK deleted the fix/539-mri-query-validation branch March 30, 2026 11:18
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.

dashboard widget add: MRI queries silently succeed but render as Internal Error

1 participant