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

@@ -5,6 +5,7 @@ import (
"strings"
"time"
"github.com/alexanderzobnin/grafana-zabbix/pkg/metrics"
"github.com/alexanderzobnin/grafana-zabbix/pkg/settings"
"github.com/alexanderzobnin/grafana-zabbix/pkg/zabbixapi"
"github.com/bitly/go-simplejson"
@@ -67,6 +68,7 @@ func (ds *Zabbix) Request(ctx context.Context, apiReq *ZabbixAPIRequest) (*simpl
ds.cache.SetAPIRequest(apiReq, resultJson)
}
} else {
metrics.CacheHitTotal.WithLabelValues(apiReq.Method).Inc()
var ok bool
resultJson, ok = cachedResult.(*simplejson.Json)
if !ok {