diff options
Diffstat (limited to 'internal/praefect/datastore/collector.go')
-rw-r--r-- | internal/praefect/datastore/collector.go | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/internal/praefect/datastore/collector.go b/internal/praefect/datastore/collector.go index af2b61553..5e1fdbd8e 100644 --- a/internal/praefect/datastore/collector.go +++ b/internal/praefect/datastore/collector.go @@ -11,16 +11,6 @@ import ( ) var ( - // This is kept for backwards compatibility as some alerting rules depend on this. - // The unavailable repositories is a more accurate description for the metric and - // is exported below so we can migrate to it. - descReadOnlyRepositories = prometheus.NewDesc( - "gitaly_praefect_read_only_repositories", - "Number of repositories in read-only mode within a virtual storage.", - []string{"virtual_storage"}, - nil, - ) - descUnavailableRepositories = prometheus.NewDesc( "gitaly_praefect_unavailable_repositories", "Number of repositories that have no healthy, up to date replicas.", @@ -34,11 +24,6 @@ var ( []string{"virtual_storage", "target_node", "state"}, nil, ) - - descriptions = []*prometheus.Desc{ - descReadOnlyRepositories, - descUnavailableRepositories, - } ) // RepositoryStoreCollector collects metrics from the RepositoryStore. @@ -66,9 +51,7 @@ func NewRepositoryStoreCollector( //nolint: stylecheck // This is unintentionally missing documentation. func (c *RepositoryStoreCollector) Describe(ch chan<- *prometheus.Desc) { - for _, desc := range descriptions { - ch <- desc - } + ch <- descUnavailableRepositories } //nolint: stylecheck // This is unintentionally missing documentation. @@ -78,14 +61,12 @@ func (c *RepositoryStoreCollector) Collect(ch chan<- prometheus.Metric) { unavailableCounts, err := CountUnavailableRepositories(ctx, c.db, c.virtualStorages) if err != nil { - c.log.WithError(err).Error("failed collecting read-only repository count metric") + c.log.WithError(err).Error("failed collecting unavailable repository count metric") return } for _, vs := range c.virtualStorages { - for _, desc := range descriptions { - ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, float64(unavailableCounts[vs]), vs) - } + ch <- prometheus.MustNewConstMetric(descUnavailableRepositories, prometheus.GaugeValue, float64(unavailableCounts[vs]), vs) } } |