diff --git a/pkg/services/dashboards/service/metrics.go b/pkg/services/dashboards/service/metrics.go index 04634d132b2..9a9beb74639 100644 --- a/pkg/services/dashboards/service/metrics.go +++ b/pkg/services/dashboards/service/metrics.go @@ -10,6 +10,8 @@ const ( metricsSubSystem = "dashboards" ) +var defaultBuckets = []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 25} + type dashboardsMetrics struct { sharedWithMeFetchDashboardsRequestsDuration *prometheus.HistogramVec searchRequestsDuration *prometheus.HistogramVec @@ -21,7 +23,7 @@ func newDashboardsMetrics(r prometheus.Registerer) *dashboardsMetrics { prometheus.HistogramOpts{ Name: "sharedwithme_fetch_dashboards_duration_seconds", Help: "Duration of fetching dashboards with permissions directly assigned to user", - Buckets: []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 25, 50, 100}, + Buckets: defaultBuckets, Namespace: metricsNamespace, Subsystem: metricsSubSystem, }, @@ -31,7 +33,7 @@ func newDashboardsMetrics(r prometheus.Registerer) *dashboardsMetrics { prometheus.HistogramOpts{ Name: "search_dashboards_duration_seconds", Help: "Duration of dashboards search (by authorization engine)", - Buckets: []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 25, 50, 100}, + Buckets: defaultBuckets, Namespace: metricsNamespace, Subsystem: metricsSubSystem, }, diff --git a/pkg/services/dashboards/service/zanzana.go b/pkg/services/dashboards/service/zanzana.go index f42155d2480..736a486e5f2 100644 --- a/pkg/services/dashboards/service/zanzana.go +++ b/pkg/services/dashboards/service/zanzana.go @@ -47,8 +47,8 @@ func (dr *DashboardServiceImpl) findDashboardsZanzanaCompare(ctx context.Context go func() { timer := prometheus.NewTimer(dr.metrics.searchRequestsDuration.WithLabelValues("zanzana")) - start := time.Now() defer timer.ObserveDuration() + start := time.Now() queryZanzana := *query res, err := dr.findDashboardsZanzana(ctx, &queryZanzana) @@ -57,8 +57,8 @@ func (dr *DashboardServiceImpl) findDashboardsZanzanaCompare(ctx context.Context go func() { timer := prometheus.NewTimer(dr.metrics.searchRequestsDuration.WithLabelValues("grafana")) - start := time.Now() defer timer.ObserveDuration() + start := time.Now() res, err := dr.FindDashboards(ctx, query) result <- searchResult{"grafana", res, err, time.Since(start)}