Seed a default dashboard with 2 starter panels (ticket 025)
ensure_default now seeds a brand-new Default profile (not one that already existed) with a "log_category" counter metric and an "Overview" dashboard containing a line and a pie panel, both querying that metric so each renders both series from a single PromQL query like any user-created panel. The counter classifies every line into exactly "category=error" or "category=other" via two new fixed-label fields on metric declarations: DeclareMetricRequest::matched_labels/unmatched_labels. These apply literal label values instead of parsing captured text, which is what keeps a case-insensitive match (e.g. "ERROR" vs "Error") collapsed into one clean series instead of fragmenting by source casing, and is also the only way to express the "line does NOT match" side at all: plain regex alternation can't do it without lookaround, which the `regex` crate doesn't support (a catch-all alternation branch always wins at the search's leftmost position). Both fields default to None and are backward compatible with existing profiles. Seeded panels are ordinary editable/deletable dashboard state, persisted through the normal profile save path; ensure_default never re-seeds or duplicates them on a later call once the profile exists. 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
8faf12f819
commit
1da00e3586
@@ -61,6 +61,9 @@ export interface MetricDeclaration {
|
||||
name: string
|
||||
message_match_regex: string
|
||||
params: MetricParamMatcher[]
|
||||
/** Fixed labels applied on a match/non-match, on top of any captured params (ticket 025). */
|
||||
matched_labels?: Record<string, string> | null
|
||||
unmatched_labels?: Record<string, string> | null
|
||||
}
|
||||
|
||||
export interface BucketValue {
|
||||
|
||||
Reference in New Issue
Block a user