Implement internal plugin metric collection

This commit is contained in:
Alexander Zobnin
2022-04-28 13:08:53 +03:00
parent 6f41260acf
commit 8b0174f8a7
6 changed files with 307 additions and 11 deletions

View File

@@ -10,6 +10,7 @@ import (
"net/http"
"net/url"
"github.com/alexanderzobnin/grafana-zabbix/pkg/metrics"
"github.com/bitly/go-simplejson"
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
"golang.org/x/net/context/ctxhttp"
@@ -106,6 +107,8 @@ func (api *ZabbixAPI) request(ctx context.Context, method string, params ZabbixA
return nil, err
}
metrics.ZabbixAPIQueryTotal.WithLabelValues(method).Inc()
req.Header.Set("Content-Type", "application/json")
req.Header.Set("User-Agent", "Grafana/grafana-zabbix")