mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Instrumentation: Add plugin service request metric (#65527)
* Service request metrics * Service request metrics
This commit is contained in:
parent
842ce14429
commit
bc5881a051
@ -38,6 +38,13 @@ var (
|
||||
Buckets: []float64{128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576},
|
||||
}, []string{"source", "plugin_id", "endpoint", "target"},
|
||||
)
|
||||
|
||||
PluginRequestDurationSeconds = prometheus.NewHistogramVec(prometheus.HistogramOpts{
|
||||
Namespace: "grafana",
|
||||
Name: "plugin_request_duration_seconds",
|
||||
Help: "Plugin request duration in seconds",
|
||||
Buckets: []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 25},
|
||||
}, []string{"source", "plugin_id", "endpoint", "status", "target"})
|
||||
)
|
||||
|
||||
const (
|
||||
@ -72,6 +79,8 @@ func instrumentPluginRequest(ctx context.Context, cfg Cfg, pluginCtx *backend.Pl
|
||||
pluginRequestDuration.WithLabelValues(pluginCtx.PluginID, endpoint, string(cfg.Target)).Observe(float64(elapsed / time.Millisecond))
|
||||
pluginRequestCounter.WithLabelValues(pluginCtx.PluginID, endpoint, status, string(cfg.Target)).Inc()
|
||||
|
||||
PluginRequestDurationSeconds.WithLabelValues("grafana-backend", pluginCtx.PluginID, endpoint, string(cfg.Target), status).Observe(elapsed.Seconds())
|
||||
|
||||
if cfg.LogDatasourceRequests {
|
||||
logParams := []interface{}{
|
||||
"status", status,
|
||||
|
Loading…
Reference in New Issue
Block a user