Skip to content

Commit

Permalink
fix small problems in metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
aajkl committed Jul 1, 2024
1 parent 3015462 commit 1433d90
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions internal/eru/agent/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func (mgr *Manager) GetMetricsCollector() *MetricsCollector {

func (e *MetricsCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- vmHealthyDesc
ch <- coreHealthyDesc
}

func (e *MetricsCollector) Collect(ch chan<- prometheus.Metric) {
Expand Down
6 changes: 3 additions & 3 deletions internal/network/drivers/ovn/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

var (
calicoHealthyDesc = prometheus.NewDesc(
ovnHealthyDesc = prometheus.NewDesc(
prometheus.BuildFQName("node", "ovn", "healthy"),
"ovn healthy status.",
[]string{"node"},
Expand All @@ -25,13 +25,13 @@ func (d *Driver) GetMetricsCollector() prometheus.Collector {
}

func (e *MetricsCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- calicoHealthyDesc
ch <- ovnHealthyDesc
}

func (e *MetricsCollector) Collect(ch chan<- prometheus.Metric) {
healthy := utils.Bool2Int(e.healthy.Load())
ch <- prometheus.MustNewConstMetric(
calicoHealthyDesc,
ovnHealthyDesc,
prometheus.GaugeValue,
float64(healthy),
configs.Hostname(),
Expand Down
10 changes: 5 additions & 5 deletions internal/network/drivers/vlan/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
)

var (
calicoHealthyDesc = prometheus.NewDesc(
prometheus.BuildFQName("network", "ovn", "healthy"),
"ovn healthy status.",
vlanHealthyDesc = prometheus.NewDesc(
prometheus.BuildFQName("network", "vlan", "healthy"),
"vlan healthy status.",
[]string{"node"},
nil)
)
Expand All @@ -25,13 +25,13 @@ func (d *Handler) GetMetricsCollector() prometheus.Collector {
}

func (e *MetricsCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- calicoHealthyDesc
ch <- vlanHealthyDesc
}

func (e *MetricsCollector) Collect(ch chan<- prometheus.Metric) {
healthy := utils.Bool2Int(e.healthy.Load())
ch <- prometheus.MustNewConstMetric(
calicoHealthyDesc,
vlanHealthyDesc,
prometheus.GaugeValue,
float64(healthy),
configs.Hostname(),
Expand Down

0 comments on commit 1433d90

Please sign in to comment.