-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(metrics): provide metrics for tenant quotas (#1094)
Signed-off-by: Lukas Boettcher <1340215+lukasboettcher@users.noreply.github.com>
- Loading branch information
1 parent
4afcfbb
commit 5efb4fb
Showing
3 changed files
with
61 additions
and
0 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2020-2023 Project Capsule Authors. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package metrics | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
"sigs.k8s.io/controller-runtime/pkg/metrics" | ||
) | ||
|
||
var ( | ||
metricsPrefix = "capsule_" | ||
|
||
TenantResourceUsage = prometheus.NewGaugeVec(prometheus.GaugeOpts{ | ||
Name: metricsPrefix + "tenant_resource_usage", | ||
Help: "Current resource usage for a given resource in a tenant", | ||
}, []string{"tenant", "resource", "resourcequotaindex"}) | ||
|
||
TenantResourceLimit = prometheus.NewGaugeVec(prometheus.GaugeOpts{ | ||
Name: metricsPrefix + "tenant_resource_limit", | ||
Help: "Current resource limit for a given resource in a tenant", | ||
}, []string{"tenant", "resource", "resourcequotaindex"}) | ||
) | ||
|
||
func init() { | ||
metrics.Registry.MustRegister( | ||
TenantResourceUsage, | ||
TenantResourceLimit, | ||
) | ||
} |