1.6 KiB
1.6 KiB
Allow editing a declared metric's properties
From WISHLIST.md: in the Metrics section, it's not clear what the properties are for existing metrics, and it should be possible to edit them when clicked.
Today, clicking a declared metric badge in Metrics.tsx only selects it to show its bucket values/trend table (setSelected(m.name)); its regex and param matchers are only visible as a title tooltip on hover (title={m.message_match_regex}), and there's no way to change a metric's regex/params after declaring it — the declaration form (declareMetric) only creates new metrics, and there's no update endpoint (src/api.rs only has GET/POST /api/metrics, no PUT /api/metrics/{name}).
Acceptance criteria
- Clicking a declared metric populates the declaration form (name, message match regex, param matchers with param_name/capture_group/kind/role) with that metric's current values, in addition to (or instead of) selecting it for the bucket-values view — make both available without one hiding the other.
- Backend gains a way to update an existing metric declaration in place (e.g.
PUT /api/metrics/{name}), reusing the existing validation fromdeclare_metric(src/api.rs,src/engine.rs). - Submitting the form while editing an existing metric updates it rather than failing on a duplicate-name conflict or silently creating a second declaration.
- The properties (regex, params, kinds, roles) are visible in the UI without relying solely on a hover tooltip — e.g. shown inline once a metric is selected/being edited.
- Declaring a brand-new metric (the existing flow) is unaffected.