Skip to content

Commit

Permalink
chore(RHTAPWATCH-741): Add recording rules for exporter
Browse files Browse the repository at this point in the history
Add recording rules to translate the components existing
metrics to expose availability.

Signed-off-by: Homaja Marisetty <[email protected]>
  • Loading branch information
hmariset committed Feb 16, 2024
1 parent 503921a commit bd6fb50
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .tekton/o11y-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ spec:
- name: url
value: https://github.com/tektoncd/catalog.git
- name: revision
value: main
value: f4708d478ee8fac6b5b68347cde087cb7c1d1b1c
- name: pathInRepo
value: task/kube-linter/0.1/kube-linter.yaml
params:
Expand Down
7 changes: 3 additions & 4 deletions exporters/dsexporter/dsexporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client/config"
)

const service = "grafana"
const check = "prometheus-appstudio-ds"
var allDataSources = GetDataSources

Expand All @@ -26,10 +25,10 @@ type CustomCollector struct {
func NewCustomCollector() *CustomCollector {
return &CustomCollector{
konfluxUp: prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "konflux_up",
Name: "grafana_ds_up",
Help: "Availability of the Konflux default grafana datasource",
},
[]string{"service", "check"}),
[]string{"check"}),
}
}

Expand All @@ -53,7 +52,7 @@ func (e *CustomCollector) Collect(ch chan<- prometheus.Metric) {
}
}

e.konfluxUp.WithLabelValues(service, check).Set(availability)
e.konfluxUp.WithLabelValues(check).Set(availability)
e.konfluxUp.Collect(ch)
}

Expand Down
5 changes: 5 additions & 0 deletions rhobs/recording/exporter_recording_rules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
groups:
- name: exporter
rules:
- record: konflux_up
expr: label_replace(grafana_ds_up, "service", "grafana", "__name__", "(.+)")

0 comments on commit bd6fb50

Please sign in to comment.