Skip to content

Commit

Permalink
[horus] Add prom multi-cluster monitoring metrics (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfordjody authored Oct 5, 2024
1 parent 681f76f commit c93f436
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions app/horus/core/horuser/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ import (
"strings"
)

var (
MultipleInfo = prometheus.NewDesc(
"horus_multiple_info",
"horus_multiple_info",
[]string{
"cluster_name",
"prometheus_address_apiserver",
},
nil)
)

func (h *Horuser) Collect(ch chan<- prometheus.Metric) {
kFunc := func(m map[string]string) string {
s := []string{}
Expand All @@ -32,6 +43,15 @@ func (h *Horuser) Collect(ch chan<- prometheus.Metric) {
buttons := map[bool]string{}
modularKey := buttons[h.cc.CustomModular.Enabled]
info[modularKey] = kFunc(h.cc.CustomModular.KubeMultiple)

for clusterName, address := range h.cc.PromMultiple {
p := prometheus.MustNewConstMetric(MultipleInfo,
prometheus.GaugeValue, 1,
clusterName,
address,
)
ch <- p
}
}

func (h *Horuser) Describe(ch chan<- *prometheus.Desc) {
Expand Down

0 comments on commit c93f436

Please sign in to comment.