-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add metrics to track RBAC adoption (#1381)
- Loading branch information
Showing
5 changed files
with
86 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package metrics | ||
|
||
import ( | ||
"github.com/RedHatInsights/insights-operator-utils/metrics" | ||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/prometheus/client_golang/prometheus/promauto" | ||
) | ||
|
||
var ( | ||
rbacIdentityTypeOps = prometheus.CounterOpts{ | ||
Name: "rbac_identity_type", | ||
Help: "The total number of requesters by identity type", | ||
} | ||
|
||
rbacServiceAccountRejectedOps = prometheus.CounterOpts{ | ||
Name: "rbac_service_accounts_rejected", | ||
Help: "The total number of service accounts that were rejected due to ACL", | ||
} | ||
) | ||
|
||
// RBACIdentityType shows number of requesters by identity type. For example | ||
// User, ServiceAccount... | ||
var RBACIdentityType = promauto.NewCounterVec(rbacIdentityTypeOps, []string{"type"}) | ||
|
||
// RBACServiceAccountRejected shows number of SAs that were rejected due to | ||
// their ACL and our RBAC policies. | ||
var RBACServiceAccountRejected = promauto.NewCounter(rbacServiceAccountRejectedOps) | ||
|
||
func AddAPIMetricsWithNamespace(namespace string) { | ||
metrics.AddAPIMetricsWithNamespace(namespace) | ||
|
||
rbacIdentityTypeOps.Namespace = namespace | ||
RBACIdentityType = promauto.NewCounterVec(rbacIdentityTypeOps, []string{"type"}) | ||
|
||
rbacServiceAccountRejectedOps.Namespace = namespace | ||
RBACServiceAccountRejected = promauto.NewCounter(rbacServiceAccountRejectedOps) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters