mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 07:35:45 -06:00
RBAC: Add histogram metric on search endpoint (#80553)
RBAC: Add histogram on search endpoint
This commit is contained in:
parent
d59a9ac3a7
commit
48ff532ca8
@ -128,6 +128,9 @@ var (
|
||||
// MAccessPermissionsSummary is a metric summary for loading permissions request duration when evaluating access
|
||||
MAccessPermissionsSummary prometheus.Histogram
|
||||
|
||||
// MSearchPermissionsSummary is a metric summary for searching permissions request duration
|
||||
MAccessSearchPermissionsSummary prometheus.Histogram
|
||||
|
||||
// MAccessEvaluationsSummary is a metric summary for loading permissions request duration when evaluating access
|
||||
MAccessEvaluationsSummary prometheus.Histogram
|
||||
)
|
||||
@ -581,6 +584,12 @@ func init() {
|
||||
Namespace: ExporterName,
|
||||
})
|
||||
|
||||
MAccessSearchPermissionsSummary = prometheus.NewHistogram(prometheus.HistogramOpts{
|
||||
Name: "access_search_permissions_duration",
|
||||
Help: "Histogram for the runtime of permissions search function",
|
||||
Buckets: prometheus.ExponentialBuckets(0.001, 4, 5),
|
||||
})
|
||||
|
||||
StatsTotalLibraryPanels = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Name: "stat_totals_library_panels",
|
||||
Help: "total amount of library panels in the database",
|
||||
@ -698,6 +707,7 @@ func initMetricVars(reg prometheus.Registerer) {
|
||||
MRenderingQueue,
|
||||
MAccessPermissionsSummary,
|
||||
MAccessEvaluationsSummary,
|
||||
MAccessSearchPermissionsSummary,
|
||||
MAlertingActiveAlerts,
|
||||
MStatTotalDashboards,
|
||||
MStatTotalFolders,
|
||||
|
@ -242,6 +242,9 @@ func (s *Service) DeclarePluginRoles(ctx context.Context, ID, name string, regs
|
||||
// SearchUsersPermissions returns all users' permissions filtered by action prefixes
|
||||
func (s *Service) SearchUsersPermissions(ctx context.Context, user identity.Requester,
|
||||
options accesscontrol.SearchOptions) (map[int64][]accesscontrol.Permission, error) {
|
||||
timer := prometheus.NewTimer(metrics.MAccessSearchPermissionsSummary)
|
||||
defer timer.ObserveDuration()
|
||||
|
||||
// Filter ram permissions
|
||||
basicPermissions := map[string][]accesscontrol.Permission{}
|
||||
for role, basicRole := range s.roles {
|
||||
|
Loading…
Reference in New Issue
Block a user