feat(explore): Add metric descriptions viewer/editor page#120242
feat(explore): Add metric descriptions viewer/editor page#120242DominikB2014 wants to merge 2 commits into
Conversation
Adds a basic list page for browsing and editing authored trace metric descriptions (name, type, brief, additional context), backed by the new trace-items/metrics list and context endpoints. Supports search, filtering by metric type, and 100-per-page pagination. Linked from the metrics explorer via a new button next to "Add Metric".
| // Scope the request to the currently selected projects / environments / | ||
| // time range, so the endpoint's existence check matches what was listed. | ||
| const query: Record<string, string | string[] | number[] | undefined> = { | ||
| project: selection.projects.length ? selection.projects.map(String) : ['-1'], |
There was a problem hiding this comment.
List save project scope mismatch
Medium Severity
The descriptions list omits the project query param when selection.projects is empty, but the edit modal sends project: ['-1']. The PUT handler uses those params for Snuba existence checks, so saves can fail with “metric not found” for rows that appeared in the table.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 67d7e8a. Configure here.
| <SimpleTable.Empty>{t('No metrics found.')}</SimpleTable.Empty> | ||
| ) : ( | ||
| metrics.map(metric => ( | ||
| <SimpleTable.Row key={`${metric.name}:${metric.type}`}> |
There was a problem hiding this comment.
Table row keys omit unit
Medium Severity
Each table row uses a React key of only metric.name and metric.type, but the metrics list API groups rows by name, type, and unit. Two rows with the same name and type but different units share a key, which can confuse React reconciliation and row-level UI such as Edit.
Reviewed by Cursor Bugbot for commit 67d7e8a. Configure here.
Follows the metrics list endpoint's alignment to the attributes `details: list[str]` context shape (#120344), and adds a dropdown to filter to metrics with authored context via `contextOnly`.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
There are 5 total unresolved issues (including 2 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3f96db7. Configure here.
| <Text>{metric.context.details.join(' ')}</Text> | ||
| ) : ( | ||
| <Text variant="muted">{'—'}</Text> | ||
| )} |
There was a problem hiding this comment.
Wrong additional context field
High Severity
The list API returns authored notes on context.additionalContext, but the UI reads context.details. The table always shows “—”, the edit form opens empty, and a save sends additionalContext: null, which can erase stored notes when only the brief is changed.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 3f96db7. Configure here.
| query: buildQueryString({search, type}), | ||
| // Restricts results to metrics that already have authored context. | ||
| contextOnly: hasContext ? '1' : undefined, | ||
| cursor: cursor || undefined, |
There was a problem hiding this comment.
Description filter query ignored
Medium Severity
The “Has description” filter sets contextOnly=1 on the metrics list request, but the trace metrics list endpoint only validates query and expand, so the parameter has no effect and the table still lists metrics without descriptions.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 3f96db7. Configure here.
| cursor: cursor || undefined, | ||
| project: selection.projects.length ? selection.projects.map(String) : undefined, | ||
| environment: selection.environments.length ? selection.environments : undefined, | ||
| }; |
There was a problem hiding this comment.
Search omits case insensitivity
Low Severity
Name search builds the same contains filter as the explore metric picker but never sends caseInsensitive=1. The metrics list uses default case-sensitive matching, so searches can miss metrics that the picker would find for the same text.
Reviewed by Cursor Bugbot for commit 3f96db7. Configure here.


Rough first pass at a page for browsing and editing trace metric descriptions, assisted query agent picks these up to make better queries.