Add DELETE /api/metrics/{name} to allow deleting a declared metric (ticket 051)
Wires the engine's existing RemoveMetricDeclaration message (previously only used internally by delete_profile's cleanup) up to a new DELETE route, persists the removal into the active profile so it survives a restart, and adds a delete affordance in the Metrics UI. Decisions: - Bucket-value history under the deleted metric's name is purged, not left orphaned (engine.rs's new remove_metric_declaration reuses update_metric's clear_metric_data helper). This is what lets a dashboard panel or PromQL query still referencing the metric by name fail with a readable "unknown metric" error instead of silently returning stale data. - evaluate_promql now errors when a metric has neither a declaration nor any bucket data, since a metric ingested via --metrics-url scraping never gets a MetricDeclaration but must stay queryable. Verified with a seeded fixture (promql_query_against_deleted_metric_fails_with_readable_error in src/api.rs). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
d17cfe9b83
commit
466c81fa94
@@ -300,6 +300,10 @@ export function updateMetric(existingName: string, request: MetricDeclaration):
|
||||
return putJson(`/api/metrics/${encodeURIComponent(existingName)}`, request)
|
||||
}
|
||||
|
||||
export function deleteMetric(name: string): Promise<void> {
|
||||
return sendJson(`/api/metrics/${encodeURIComponent(name)}`, 'DELETE')
|
||||
}
|
||||
|
||||
export function fetchMetricBucketValues(
|
||||
name: string,
|
||||
params: {
|
||||
|
||||
Reference in New Issue
Block a user