mirror of https://github.com/grafana/grafana
AuthZ service: Add metrics (#99007)
* add metrics for authZ MT service * remove metrics that are already tracked by the GRPC server metrics Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com> * undo unneeded change * test fix --------- Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>pull/99395/head^2
parent
437b7a565d
commit
33a53d170b
@ -0,0 +1,39 @@ |
||||
package rbac |
||||
|
||||
import ( |
||||
"github.com/prometheus/client_golang/prometheus" |
||||
"github.com/prometheus/client_golang/prometheus/promauto" |
||||
) |
||||
|
||||
const ( |
||||
metricsNamespace = "iam" |
||||
metricsSubSystem = "authz_direct_db_service" |
||||
) |
||||
|
||||
type metrics struct { |
||||
requestCount *prometheus.CounterVec |
||||
permissionCacheUsage *prometheus.CounterVec |
||||
} |
||||
|
||||
func newMetrics(reg prometheus.Registerer) *metrics { |
||||
return &metrics{ |
||||
requestCount: promauto.With(reg).NewCounterVec( |
||||
prometheus.CounterOpts{ |
||||
Namespace: metricsNamespace, |
||||
Subsystem: metricsSubSystem, |
||||
Name: "invalid_request_count", |
||||
Help: "AuthZ service invalid request count", |
||||
}, |
||||
[]string{"is_error", "valid", "verb", "group", "resource"}, |
||||
), |
||||
permissionCacheUsage: promauto.With(reg).NewCounterVec( |
||||
prometheus.CounterOpts{ |
||||
Namespace: metricsNamespace, |
||||
Subsystem: metricsSubSystem, |
||||
Name: "permission_cache_usage", |
||||
Help: "AuthZ service permission cache usage", |
||||
}, |
||||
[]string{"cache_hit", "action"}, |
||||
), |
||||
} |
||||
} |
Loading…
Reference in new issue