New ptuitl/safeprom doesn't have Rounded in the type names

This version fixes the test issue of double registering metrics.

* Closes: #40367
This commit is contained in:
meskio 2024-07-11 17:45:57 +02:00
parent 9e977fe6ca
commit f64f234eeb
No known key found for this signature in database
GPG key ID: 52B8F5AC97A2DA86
3 changed files with 41 additions and 37 deletions

View file

@ -331,14 +331,14 @@ func sumMapValues(m *map[messages.RendezvousMethod]uint) uint {
type PromMetrics struct {
registry *prometheus.Registry
ProxyTotal *prometheus.CounterVec
ProxyPollTotal *safeprom.RoundedCounterVec
ClientPollTotal *safeprom.RoundedCounterVec
ProxyPollTotal *safeprom.CounterVec
ClientPollTotal *safeprom.CounterVec
AvailableProxies *prometheus.GaugeVec
ProxyPollWithRelayURLExtensionTotal *safeprom.RoundedCounterVec
ProxyPollWithoutRelayURLExtensionTotal *safeprom.RoundedCounterVec
ProxyPollWithRelayURLExtensionTotal *safeprom.CounterVec
ProxyPollWithoutRelayURLExtensionTotal *safeprom.CounterVec
ProxyPollRejectedForRelayURLExtensionTotal *safeprom.RoundedCounterVec
ProxyPollRejectedForRelayURLExtensionTotal *safeprom.CounterVec
}
// Initialize metrics for prometheus exporter
@ -365,7 +365,7 @@ func initPrometheus() *PromMetrics {
[]string{"type", "nat"},
)
promMetrics.ProxyPollTotal = safeprom.NewRoundedCounterVec(
promMetrics.ProxyPollTotal = safeprom.NewCounterVec(
prometheus.CounterOpts{
Namespace: prometheusNamespace,
Name: "rounded_proxy_poll_total",
@ -374,7 +374,7 @@ func initPrometheus() *PromMetrics {
[]string{"nat", "status"},
)
promMetrics.ProxyPollWithRelayURLExtensionTotal = safeprom.NewRoundedCounterVec(
promMetrics.ProxyPollWithRelayURLExtensionTotal = safeprom.NewCounterVec(
prometheus.CounterOpts{
Namespace: prometheusNamespace,
Name: "rounded_proxy_poll_with_relay_url_extension_total",
@ -383,7 +383,7 @@ func initPrometheus() *PromMetrics {
[]string{"nat", "type"},
)
promMetrics.ProxyPollWithoutRelayURLExtensionTotal = safeprom.NewRoundedCounterVec(
promMetrics.ProxyPollWithoutRelayURLExtensionTotal = safeprom.NewCounterVec(
prometheus.CounterOpts{
Namespace: prometheusNamespace,
Name: "rounded_proxy_poll_without_relay_url_extension_total",
@ -392,7 +392,7 @@ func initPrometheus() *PromMetrics {
[]string{"nat", "type"},
)
promMetrics.ProxyPollRejectedForRelayURLExtensionTotal = safeprom.NewRoundedCounterVec(
promMetrics.ProxyPollRejectedForRelayURLExtensionTotal = safeprom.NewCounterVec(
prometheus.CounterOpts{
Namespace: prometheusNamespace,
Name: "rounded_proxy_poll_rejected_relay_url_extension_total",
@ -401,7 +401,7 @@ func initPrometheus() *PromMetrics {
[]string{"nat", "type"},
)
promMetrics.ClientPollTotal = safeprom.NewRoundedCounterVec(
promMetrics.ClientPollTotal = safeprom.NewCounterVec(
prometheus.CounterOpts{
Namespace: prometheusNamespace,
Name: "rounded_client_poll_total",