Rename root, api and sdk module paths (imports, go.mod, go_package, ldflags, build scripts, buf configs) and regenerate protobuf/gateway code with the project's pinned toolchain. Wire identifiers unchanged. api gets a local replace for sdk; root/api/sdk require v0.1.0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
// Copyright IBM Corp. 2020, 2026
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package ratelimit
|
|
|
|
import (
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/globals"
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
)
|
|
|
|
const (
|
|
subsystem = "controller_api_ratelimiter"
|
|
)
|
|
|
|
var (
|
|
rateLimitQuotaStorageCapacity prometheus.Gauge = prometheus.NewGauge(
|
|
prometheus.GaugeOpts{
|
|
Namespace: globals.MetricNamespace,
|
|
Subsystem: subsystem,
|
|
Name: "quota_storage_capacity",
|
|
Help: "Guague of the number if quotas that can be stored by the rate limiter",
|
|
},
|
|
)
|
|
rateLimitQuotaUsage prometheus.Gauge = prometheus.NewGauge(
|
|
prometheus.GaugeOpts{
|
|
Namespace: globals.MetricNamespace,
|
|
Subsystem: subsystem,
|
|
Name: "quota_storage_usage",
|
|
Help: "Guague of the number if quotas that are currently being stored by the rate limiter",
|
|
},
|
|
)
|
|
)
|
|
|
|
// InitializeMetrics initializes the metrics for visibility into the rate limiter.
|
|
func InitializeMetrics(r prometheus.Registerer) {
|
|
if r == nil {
|
|
return
|
|
}
|
|
r.MustRegister(
|
|
rateLimitQuotaStorageCapacity,
|
|
rateLimitQuotaUsage,
|
|
)
|
|
}
|