fix: Update metric naming

Fix up metric names to follow best practice naming conventions[0].

[0]: https://prometheus.io/docs/practices/naming/

Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
SuperQ 2025-06-12 09:23:27 +02:00
parent 4bfbc66ea7
commit e2a9d0a9cd
No known key found for this signature in database
GPG Key ID: C646B23C9E3245F1
2 changed files with 24 additions and 24 deletions

View File

@ -51,34 +51,34 @@ var (
) )
metricCloudConnectionEstablishedTimestamp = promauto.NewGauge( metricCloudConnectionEstablishedTimestamp = promauto.NewGauge(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
Name: "jetkvm_cloud_connection_established_timestamp", Name: "jetkvm_cloud_connection_established_timestamp_seconds",
Help: "The timestamp when the cloud connection was established", Help: "The timestamp when the cloud connection was established",
}, },
) )
metricConnectionLastPingTimestamp = promauto.NewGaugeVec( metricConnectionLastPingTimestamp = promauto.NewGaugeVec(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
Name: "jetkvm_connection_last_ping_timestamp", Name: "jetkvm_connection_last_ping_timestamp_seconds",
Help: "The timestamp when the last ping response was received", Help: "The timestamp when the last ping response was received",
}, },
[]string{"type", "source"}, []string{"type", "source"},
) )
metricConnectionLastPingReceivedTimestamp = promauto.NewGaugeVec( metricConnectionLastPingReceivedTimestamp = promauto.NewGaugeVec(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
Name: "jetkvm_connection_last_ping_received_timestamp", Name: "jetkvm_connection_last_ping_received_timestamp_seconds",
Help: "The timestamp when the last ping request was received", Help: "The timestamp when the last ping request was received",
}, },
[]string{"type", "source"}, []string{"type", "source"},
) )
metricConnectionLastPingDuration = promauto.NewGaugeVec( metricConnectionLastPingDuration = promauto.NewGaugeVec(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
Name: "jetkvm_connection_last_ping_duration", Name: "jetkvm_connection_last_ping_duration_seconds",
Help: "The duration of the last ping response", Help: "The duration of the last ping response",
}, },
[]string{"type", "source"}, []string{"type", "source"},
) )
metricConnectionPingDuration = promauto.NewHistogramVec( metricConnectionPingDuration = promauto.NewHistogramVec(
prometheus.HistogramOpts{ prometheus.HistogramOpts{
Name: "jetkvm_connection_ping_duration", Name: "jetkvm_connection_ping_duration_seconds",
Help: "The duration of the ping response", Help: "The duration of the ping response",
Buckets: []float64{ Buckets: []float64{
0.1, 0.5, 1, 10, 0.1, 0.5, 1, 10,
@ -88,28 +88,28 @@ var (
) )
metricConnectionTotalPingSentCount = promauto.NewCounterVec( metricConnectionTotalPingSentCount = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "jetkvm_connection_total_ping_sent", Name: "jetkvm_connection_ping_sent_total",
Help: "The total number of pings sent to the connection", Help: "The total number of pings sent to the connection",
}, },
[]string{"type", "source"}, []string{"type", "source"},
) )
metricConnectionTotalPingReceivedCount = promauto.NewCounterVec( metricConnectionTotalPingReceivedCount = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "jetkvm_connection_total_ping_received", Name: "jetkvm_connection_ping_received_total",
Help: "The total number of pings received from the connection", Help: "The total number of pings received from the connection",
}, },
[]string{"type", "source"}, []string{"type", "source"},
) )
metricConnectionSessionRequestCount = promauto.NewCounterVec( metricConnectionSessionRequestCount = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "jetkvm_connection_session_total_requests", Name: "jetkvm_connection_session_requests_total",
Help: "The total number of session requests received", Help: "The total number of session requests received",
}, },
[]string{"type", "source"}, []string{"type", "source"},
) )
metricConnectionSessionRequestDuration = promauto.NewHistogramVec( metricConnectionSessionRequestDuration = promauto.NewHistogramVec(
prometheus.HistogramOpts{ prometheus.HistogramOpts{
Name: "jetkvm_connection_session_request_duration", Name: "jetkvm_connection_session_request_duration_seconds",
Help: "The duration of session requests", Help: "The duration of session requests",
Buckets: []float64{ Buckets: []float64{
0.1, 0.5, 1, 10, 0.1, 0.5, 1, 10,
@ -119,7 +119,7 @@ var (
) )
metricConnectionLastSessionRequestTimestamp = promauto.NewGaugeVec( metricConnectionLastSessionRequestTimestamp = promauto.NewGaugeVec(
prometheus.GaugeOpts{ prometheus.GaugeOpts{
Name: "jetkvm_connection_last_session_request_timestamp", Name: "jetkvm_connection_last_session_request_timestamp_seconds",
Help: "The timestamp of the last session request", Help: "The timestamp of the last session request",
}, },
[]string{"type", "source"}, []string{"type", "source"},
@ -133,7 +133,7 @@ var (
) )
metricCloudConnectionFailureCount = promauto.NewCounter( metricCloudConnectionFailureCount = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "jetkvm_cloud_connection_failure_count", Name: "jetkvm_cloud_connection_failure_total",
Help: "The number of times the cloud connection has failed", Help: "The number of times the cloud connection has failed",
}, },
) )

View File

@ -14,44 +14,44 @@ var (
) )
metricTimeSyncCount = promauto.NewCounter( metricTimeSyncCount = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "jetkvm_timesync_count", Name: "jetkvm_timesync_total",
Help: "The number of times the timesync has been run", Help: "The number of times the timesync has been run",
}, },
) )
metricTimeSyncSuccessCount = promauto.NewCounter( metricTimeSyncSuccessCount = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "jetkvm_timesync_success_count", Name: "jetkvm_timesync_success_total",
Help: "The number of times the timesync has been successful", Help: "The number of times the timesync has been successful",
}, },
) )
metricRTCUpdateCount = promauto.NewCounter( //nolint:unused metricRTCUpdateCount = promauto.NewCounter( //nolint:unused
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "jetkvm_timesync_rtc_update_count", Name: "jetkvm_timesync_rtc_update_total",
Help: "The number of times the RTC has been updated", Help: "The number of times the RTC has been updated",
}, },
) )
metricNtpTotalSuccessCount = promauto.NewCounter( metricNtpTotalSuccessCount = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "jetkvm_timesync_ntp_total_success_count", Name: "jetkvm_timesync_ntp_total_success_total",
Help: "The total number of successful NTP requests", Help: "The total number of successful NTP requests",
}, },
) )
metricNtpTotalRequestCount = promauto.NewCounter( metricNtpTotalRequestCount = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "jetkvm_timesync_ntp_total_request_count", Name: "jetkvm_timesync_ntp_total_request_total",
Help: "The total number of NTP requests sent", Help: "The total number of NTP requests sent",
}, },
) )
metricNtpSuccessCount = promauto.NewCounterVec( metricNtpSuccessCount = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "jetkvm_timesync_ntp_success_count", Name: "jetkvm_timesync_ntp_success_total",
Help: "The number of successful NTP requests", Help: "The number of successful NTP requests",
}, },
[]string{"url"}, []string{"url"},
) )
metricNtpRequestCount = promauto.NewCounterVec( metricNtpRequestCount = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "jetkvm_timesync_ntp_request_count", Name: "jetkvm_timesync_ntp_request_total",
Help: "The number of NTP requests sent to the server", Help: "The number of NTP requests sent to the server",
}, },
[]string{"url"}, []string{"url"},
@ -83,39 +83,39 @@ var (
metricHttpTotalSuccessCount = promauto.NewCounter( metricHttpTotalSuccessCount = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "jetkvm_timesync_http_total_success_count", Name: "jetkvm_timesync_http_total_success_total",
Help: "The total number of successful HTTP requests", Help: "The total number of successful HTTP requests",
}, },
) )
metricHttpTotalRequestCount = promauto.NewCounter( metricHttpTotalRequestCount = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "jetkvm_timesync_http_total_request_count", Name: "jetkvm_timesync_http_total_request_total",
Help: "The total number of HTTP requests sent", Help: "The total number of HTTP requests sent",
}, },
) )
metricHttpTotalCancelCount = promauto.NewCounter( metricHttpTotalCancelCount = promauto.NewCounter(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "jetkvm_timesync_http_total_cancel_count", Name: "jetkvm_timesync_http_total_cancel_total",
Help: "The total number of HTTP requests cancelled", Help: "The total number of HTTP requests cancelled",
}, },
) )
metricHttpSuccessCount = promauto.NewCounterVec( metricHttpSuccessCount = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "jetkvm_timesync_http_success_count", Name: "jetkvm_timesync_http_success_total",
Help: "The number of successful HTTP requests", Help: "The number of successful HTTP requests",
}, },
[]string{"url"}, []string{"url"},
) )
metricHttpRequestCount = promauto.NewCounterVec( metricHttpRequestCount = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "jetkvm_timesync_http_request_count", Name: "jetkvm_timesync_http_request_total",
Help: "The number of HTTP requests sent to the server", Help: "The number of HTTP requests sent to the server",
}, },
[]string{"url"}, []string{"url"},
) )
metricHttpCancelCount = promauto.NewCounterVec( metricHttpCancelCount = promauto.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "jetkvm_timesync_http_cancel_count", Name: "jetkvm_timesync_http_cancel_total",
Help: "The number of HTTP requests cancelled", Help: "The number of HTTP requests cancelled",
}, },
[]string{"url"}, []string{"url"},