Wire up data source config metrics correctly

Fix metrics for data source configuration CRUD.

Make sure to only create one histogram and only register it with prometheus once.
This commit is contained in:
beejeebus
2025-12-10 16:16:22 -05:00
parent 30045c02c0
commit e433cfa02d
2 changed files with 39 additions and 21 deletions
@@ -57,6 +57,11 @@ func (s *legacyStorage) ConvertToTable(ctx context.Context, object runtime.Objec
}
func (s *legacyStorage) List(ctx context.Context, options *internalversion.ListOptions) (runtime.Object, error) {
start := time.Now()
defer func() {
metricutil.ObserveWithExemplar(ctx, s.dsConfigHandlerRequestsDuration.WithLabelValues("new", "List"), time.Since(start).Seconds())
}()
return s.datasources.ListDataSources(ctx)
}