mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 23:55:47 -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 is a metric summary for loading permissions request duration when evaluating access
|
||||||
MAccessPermissionsSummary prometheus.Histogram
|
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 is a metric summary for loading permissions request duration when evaluating access
|
||||||
MAccessEvaluationsSummary prometheus.Histogram
|
MAccessEvaluationsSummary prometheus.Histogram
|
||||||
)
|
)
|
||||||
@ -581,6 +584,12 @@ func init() {
|
|||||||
Namespace: ExporterName,
|
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{
|
StatsTotalLibraryPanels = prometheus.NewGauge(prometheus.GaugeOpts{
|
||||||
Name: "stat_totals_library_panels",
|
Name: "stat_totals_library_panels",
|
||||||
Help: "total amount of library panels in the database",
|
Help: "total amount of library panels in the database",
|
||||||
@ -698,6 +707,7 @@ func initMetricVars(reg prometheus.Registerer) {
|
|||||||
MRenderingQueue,
|
MRenderingQueue,
|
||||||
MAccessPermissionsSummary,
|
MAccessPermissionsSummary,
|
||||||
MAccessEvaluationsSummary,
|
MAccessEvaluationsSummary,
|
||||||
|
MAccessSearchPermissionsSummary,
|
||||||
MAlertingActiveAlerts,
|
MAlertingActiveAlerts,
|
||||||
MStatTotalDashboards,
|
MStatTotalDashboards,
|
||||||
MStatTotalFolders,
|
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
|
// SearchUsersPermissions returns all users' permissions filtered by action prefixes
|
||||||
func (s *Service) SearchUsersPermissions(ctx context.Context, user identity.Requester,
|
func (s *Service) SearchUsersPermissions(ctx context.Context, user identity.Requester,
|
||||||
options accesscontrol.SearchOptions) (map[int64][]accesscontrol.Permission, error) {
|
options accesscontrol.SearchOptions) (map[int64][]accesscontrol.Permission, error) {
|
||||||
|
timer := prometheus.NewTimer(metrics.MAccessSearchPermissionsSummary)
|
||||||
|
defer timer.ObserveDuration()
|
||||||
|
|
||||||
// Filter ram permissions
|
// Filter ram permissions
|
||||||
basicPermissions := map[string][]accesscontrol.Permission{}
|
basicPermissions := map[string][]accesscontrol.Permission{}
|
||||||
for role, basicRole := range s.roles {
|
for role, basicRole := range s.roles {
|
||||||
|
Loading…
Reference in New Issue
Block a user