Skip to content

Commit

Permalink
required labels panel wip
Browse files Browse the repository at this point in the history
Signed-off-by: Owen Diehl <[email protected]>
  • Loading branch information
owen-d committed Oct 10, 2024
1 parent 2a37450 commit 4179355
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions pkg/dash/dash.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
prom "github.com/prometheus/client_golang/prometheus"
)

var requiredLabels = []string{"cluster", "namespace", "container"}

type DashboardLoader struct {
ml DependencyLoader

Expand Down Expand Up @@ -173,6 +175,31 @@ Backend,%s`,
),
)

var targets []*prometheus.DataqueryBuilder
for _, l := range requiredLabels {
targets = append(
targets,
prometheus.NewDataqueryBuilder().
Instant().
Expr(
fmt.Sprintf(
`absent(sum(loki_build_info{%s!=""}))`,
l,
),
).LegendFormat(l),
)
}

panel := table.NewPanelBuilder().
Span(8).
Title("Missing required labels").
Description("Required labels not present on Loki instances")

for _, t := range targets {
panel.WithTarget(t)
}

builder.WithPanel(panel)
}

func forceTpl(name, s string) *template.Template {
Expand Down

0 comments on commit 4179355

Please sign in to comment.