Skip to content

Commit 58ade3b

Browse files
authored
fix: Update metric naming (#602)
Fix up metric names to follow best practice naming conventions[0]. [0]: https://prometheus.io/docs/practices/naming/ Signed-off-by: SuperQ <[email protected]>
1 parent 3cc119c commit 58ade3b

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

cloud.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,34 +51,34 @@ var (
5151
)
5252
metricCloudConnectionEstablishedTimestamp = promauto.NewGauge(
5353
prometheus.GaugeOpts{
54-
Name: "jetkvm_cloud_connection_established_timestamp",
54+
Name: "jetkvm_cloud_connection_established_timestamp_seconds",
5555
Help: "The timestamp when the cloud connection was established",
5656
},
5757
)
5858
metricConnectionLastPingTimestamp = promauto.NewGaugeVec(
5959
prometheus.GaugeOpts{
60-
Name: "jetkvm_connection_last_ping_timestamp",
60+
Name: "jetkvm_connection_last_ping_timestamp_seconds",
6161
Help: "The timestamp when the last ping response was received",
6262
},
6363
[]string{"type", "source"},
6464
)
6565
metricConnectionLastPingReceivedTimestamp = promauto.NewGaugeVec(
6666
prometheus.GaugeOpts{
67-
Name: "jetkvm_connection_last_ping_received_timestamp",
67+
Name: "jetkvm_connection_last_ping_received_timestamp_seconds",
6868
Help: "The timestamp when the last ping request was received",
6969
},
7070
[]string{"type", "source"},
7171
)
7272
metricConnectionLastPingDuration = promauto.NewGaugeVec(
7373
prometheus.GaugeOpts{
74-
Name: "jetkvm_connection_last_ping_duration",
74+
Name: "jetkvm_connection_last_ping_duration_seconds",
7575
Help: "The duration of the last ping response",
7676
},
7777
[]string{"type", "source"},
7878
)
7979
metricConnectionPingDuration = promauto.NewHistogramVec(
8080
prometheus.HistogramOpts{
81-
Name: "jetkvm_connection_ping_duration",
81+
Name: "jetkvm_connection_ping_duration_seconds",
8282
Help: "The duration of the ping response",
8383
Buckets: []float64{
8484
0.1, 0.5, 1, 10,
@@ -88,28 +88,28 @@ var (
8888
)
8989
metricConnectionTotalPingSentCount = promauto.NewCounterVec(
9090
prometheus.CounterOpts{
91-
Name: "jetkvm_connection_total_ping_sent",
91+
Name: "jetkvm_connection_ping_sent_total",
9292
Help: "The total number of pings sent to the connection",
9393
},
9494
[]string{"type", "source"},
9595
)
9696
metricConnectionTotalPingReceivedCount = promauto.NewCounterVec(
9797
prometheus.CounterOpts{
98-
Name: "jetkvm_connection_total_ping_received",
98+
Name: "jetkvm_connection_ping_received_total",
9999
Help: "The total number of pings received from the connection",
100100
},
101101
[]string{"type", "source"},
102102
)
103103
metricConnectionSessionRequestCount = promauto.NewCounterVec(
104104
prometheus.CounterOpts{
105-
Name: "jetkvm_connection_session_total_requests",
105+
Name: "jetkvm_connection_session_requests_total",
106106
Help: "The total number of session requests received",
107107
},
108108
[]string{"type", "source"},
109109
)
110110
metricConnectionSessionRequestDuration = promauto.NewHistogramVec(
111111
prometheus.HistogramOpts{
112-
Name: "jetkvm_connection_session_request_duration",
112+
Name: "jetkvm_connection_session_request_duration_seconds",
113113
Help: "The duration of session requests",
114114
Buckets: []float64{
115115
0.1, 0.5, 1, 10,
@@ -119,7 +119,7 @@ var (
119119
)
120120
metricConnectionLastSessionRequestTimestamp = promauto.NewGaugeVec(
121121
prometheus.GaugeOpts{
122-
Name: "jetkvm_connection_last_session_request_timestamp",
122+
Name: "jetkvm_connection_last_session_request_timestamp_seconds",
123123
Help: "The timestamp of the last session request",
124124
},
125125
[]string{"type", "source"},
@@ -133,7 +133,7 @@ var (
133133
)
134134
metricCloudConnectionFailureCount = promauto.NewCounter(
135135
prometheus.CounterOpts{
136-
Name: "jetkvm_cloud_connection_failure_count",
136+
Name: "jetkvm_cloud_connection_failure_total",
137137
Help: "The number of times the cloud connection has failed",
138138
},
139139
)

internal/timesync/metrics.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,44 @@ var (
1414
)
1515
metricTimeSyncCount = promauto.NewCounter(
1616
prometheus.CounterOpts{
17-
Name: "jetkvm_timesync_count",
17+
Name: "jetkvm_timesync_total",
1818
Help: "The number of times the timesync has been run",
1919
},
2020
)
2121
metricTimeSyncSuccessCount = promauto.NewCounter(
2222
prometheus.CounterOpts{
23-
Name: "jetkvm_timesync_success_count",
23+
Name: "jetkvm_timesync_success_total",
2424
Help: "The number of times the timesync has been successful",
2525
},
2626
)
2727
metricRTCUpdateCount = promauto.NewCounter( //nolint:unused
2828
prometheus.CounterOpts{
29-
Name: "jetkvm_timesync_rtc_update_count",
29+
Name: "jetkvm_timesync_rtc_update_total",
3030
Help: "The number of times the RTC has been updated",
3131
},
3232
)
3333
metricNtpTotalSuccessCount = promauto.NewCounter(
3434
prometheus.CounterOpts{
35-
Name: "jetkvm_timesync_ntp_total_success_count",
35+
Name: "jetkvm_timesync_ntp_total_success_total",
3636
Help: "The total number of successful NTP requests",
3737
},
3838
)
3939
metricNtpTotalRequestCount = promauto.NewCounter(
4040
prometheus.CounterOpts{
41-
Name: "jetkvm_timesync_ntp_total_request_count",
41+
Name: "jetkvm_timesync_ntp_total_request_total",
4242
Help: "The total number of NTP requests sent",
4343
},
4444
)
4545
metricNtpSuccessCount = promauto.NewCounterVec(
4646
prometheus.CounterOpts{
47-
Name: "jetkvm_timesync_ntp_success_count",
47+
Name: "jetkvm_timesync_ntp_success_total",
4848
Help: "The number of successful NTP requests",
4949
},
5050
[]string{"url"},
5151
)
5252
metricNtpRequestCount = promauto.NewCounterVec(
5353
prometheus.CounterOpts{
54-
Name: "jetkvm_timesync_ntp_request_count",
54+
Name: "jetkvm_timesync_ntp_request_total",
5555
Help: "The number of NTP requests sent to the server",
5656
},
5757
[]string{"url"},
@@ -83,39 +83,39 @@ var (
8383

8484
metricHttpTotalSuccessCount = promauto.NewCounter(
8585
prometheus.CounterOpts{
86-
Name: "jetkvm_timesync_http_total_success_count",
86+
Name: "jetkvm_timesync_http_total_success_total",
8787
Help: "The total number of successful HTTP requests",
8888
},
8989
)
9090
metricHttpTotalRequestCount = promauto.NewCounter(
9191
prometheus.CounterOpts{
92-
Name: "jetkvm_timesync_http_total_request_count",
92+
Name: "jetkvm_timesync_http_total_request_total",
9393
Help: "The total number of HTTP requests sent",
9494
},
9595
)
9696
metricHttpTotalCancelCount = promauto.NewCounter(
9797
prometheus.CounterOpts{
98-
Name: "jetkvm_timesync_http_total_cancel_count",
98+
Name: "jetkvm_timesync_http_total_cancel_total",
9999
Help: "The total number of HTTP requests cancelled",
100100
},
101101
)
102102
metricHttpSuccessCount = promauto.NewCounterVec(
103103
prometheus.CounterOpts{
104-
Name: "jetkvm_timesync_http_success_count",
104+
Name: "jetkvm_timesync_http_success_total",
105105
Help: "The number of successful HTTP requests",
106106
},
107107
[]string{"url"},
108108
)
109109
metricHttpRequestCount = promauto.NewCounterVec(
110110
prometheus.CounterOpts{
111-
Name: "jetkvm_timesync_http_request_count",
111+
Name: "jetkvm_timesync_http_request_total",
112112
Help: "The number of HTTP requests sent to the server",
113113
},
114114
[]string{"url"},
115115
)
116116
metricHttpCancelCount = promauto.NewCounterVec(
117117
prometheus.CounterOpts{
118-
Name: "jetkvm_timesync_http_cancel_count",
118+
Name: "jetkvm_timesync_http_cancel_total",
119119
Help: "The number of HTTP requests cancelled",
120120
},
121121
[]string{"url"},

0 commit comments

Comments
 (0)