Skip to content

Commit

Permalink
further linter corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
Disper committed Mar 4, 2024
1 parent 94d8738 commit 0e2f13b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/controller/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
)

const (
runtimeIdKeyName = "runtimeId"
runtimeIDKeyName = "runtimeId"
state = "state"
reason = "reason"
runtimeIdLabel = "kyma-project.io/runtime-id"
runtimeIDLabel = "kyma-project.io/runtime-id"
componentName = "infrastructure_manager"
)

Expand All @@ -26,19 +26,19 @@ func NewMetrics() Metrics {
Subsystem: componentName,
Name: "im_gardener_clusters_state",
Help: "Indicates the Status.state for GardenerCluster CRs",
}, []string{runtimeIdKeyName, state, reason}),
}, []string{runtimeIDKeyName, state, reason}),
}
ctrlMetrics.Registry.MustRegister(m.gardenerClustersStateGaugeVec)
return m
}

func (m Metrics) SetGardenerClusterStates(cluster v1.GardenerCluster) {
var runtimeId = cluster.GetLabels()[runtimeIdLabel]
var runtimeId = cluster.GetLabels()[runtimeIDLabel]

Check warning on line 36 in internal/controller/metrics/metrics.go

View workflow job for this annotation

GitHub Actions / lint

var-naming: var runtimeId should be runtimeID (revive)

if runtimeId != "" {
var reason = cluster.Status.Conditions[0].Reason

//first clean the old metric
// first clean the old metric
m.cleanUpGardenerClusterGauge(runtimeId)
m.gardenerClustersStateGaugeVec.WithLabelValues(runtimeId, string(cluster.Status.State), reason).Set(1)
}
Expand All @@ -61,7 +61,7 @@ func (m Metrics) cleanUpGardenerClusterGauge(runtimeId string) {
fmt.Printf("GardenerClusterStates set value to 0 for %v", runtimeId)

metricsDeleted := m.gardenerClustersStateGaugeVec.DeletePartialMatch(prometheus.Labels{
runtimeIdKeyName: runtimeId,
runtimeIDKeyName: runtimeId,
})

if metricsDeleted > 0 {
Expand Down

0 comments on commit 0e2f13b

Please sign in to comment.