SSE: (Instrumentation/Chore) Add datasource_type label to grafana_sse (#72370)

SSE: (Instrumentation/Chore) Add datasource_type label to the grafana_sse_ds_queries_total metric
This commit is contained in:
Kyle Brandt 2023-07-26 10:51:02 -04:00 committed by GitHub
parent 6f3dfb2d8b
commit ceb694f165
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -23,7 +23,7 @@ func newMetrics(reg prometheus.Registerer) *metrics {
Subsystem: metricsSubSystem,
Name: "ds_queries_total",
Help: "Number of datasource queries made via server side expression requests",
}, []string{"error", "dataplane"}),
}, []string{"error", "dataplane", "datasource_type"}),
// older (No Namespace or Subsystem)
expressionsQuerySummary: prometheus.NewSummaryVec(

View File

@ -81,7 +81,7 @@ func (m *MLNode) Execute(ctx context.Context, now time.Time, _ mathexp.Vars, s *
}
logger.Debug("Data source queried", "responseType", responseType)
useDataplane := strings.HasPrefix("dataplane-", responseType)
s.metrics.dsRequests.WithLabelValues(respStatus, fmt.Sprintf("%t", useDataplane)).Inc()
s.metrics.dsRequests.WithLabelValues(respStatus, fmt.Sprintf("%t", useDataplane), mlPluginID).Inc()
}()
// Execute the command and provide callback function for sending a request via plugin API.

View File

@ -235,7 +235,7 @@ func (dn *DSNode) Execute(ctx context.Context, now time.Time, _ mathexp.Vars, s
}
logger.Debug("Data source queried", "responseType", responseType)
useDataplane := strings.HasPrefix(responseType, "dataplane-")
s.metrics.dsRequests.WithLabelValues(respStatus, fmt.Sprintf("%t", useDataplane)).Inc()
s.metrics.dsRequests.WithLabelValues(respStatus, fmt.Sprintf("%t", useDataplane), dn.datasource.Type).Inc()
}()
resp, err := s.dataService.QueryData(ctx, req)