mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 00:01:48 +08:00
Backend plugins: Exclude plugin metrics in Grafana's metrics endpoint (#22857)
Excludes backend plugin metrics in Grafana's metrics endpoint Adds /api/:pluginId/metrics endpoint for retrieving metrics from backend plugin as Prometheus text-based exposition format. Fixes #22814
This commit is contained in:

committed by
GitHub

parent
aa4ed76a00
commit
60e3437fc1
@ -59,6 +59,23 @@ func checkHealthResultFromProto(protoResp *pluginv2.CheckHealthResponse) *CheckH
|
||||
}
|
||||
}
|
||||
|
||||
func collectMetricsResultFromProto(protoResp *pluginv2.CollectMetricsResponse) *CollectMetricsResult {
|
||||
var prometheusMetrics []byte
|
||||
|
||||
if protoResp.Metrics != nil {
|
||||
prometheusMetrics = protoResp.Metrics.Prometheus
|
||||
}
|
||||
|
||||
return &CollectMetricsResult{
|
||||
PrometheusMetrics: prometheusMetrics,
|
||||
}
|
||||
}
|
||||
|
||||
// CollectMetricsResult collect metrics result.
|
||||
type CollectMetricsResult struct {
|
||||
PrometheusMetrics []byte
|
||||
}
|
||||
|
||||
type DataSourceConfig struct {
|
||||
ID int64
|
||||
Name string
|
||||
|
Reference in New Issue
Block a user