Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.

Commit 24c5b37

Browse files
authored
fix: update metric names to follow prometheus naming guide (#228)
The [Prometheus metric naming guidelines](https://prometheus.io/docs/practices/naming/) say they should have suffixes like `_total` for unit-less counts and `_info` for metadata.
1 parent 3aadf43 commit 24c5b37

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/listener.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,22 @@ export class TCPListener extends EventEmitter<ListenerEvents> implements Listene
8383
addr = `${address.address}:${address.port}`
8484
}
8585

86-
context.metrics?.registerMetric(`libp2p_tcp_connections_${addr}_count`, {
86+
context.metrics?.registerMetric(`libp2p_tcp_connections_${addr}_total`, {
8787
help: 'Current active connections in TCP listener',
8888
calculate: () => {
8989
return this.connections.size
9090
}
9191
})
9292

9393
this.metrics = {
94-
status: context.metrics.registerMetric(`libp2p_tcp_${addr}_server_status`, {
94+
status: context.metrics.registerMetric(`libp2p_tcp_${addr}_server_status_info`, {
9595
help: 'Current status of the TCP server'
9696
}),
9797
errors: context.metrics.registerCounterGroup(`libp2p_tcp_${addr}_server_errors_total`, {
9898
label: 'error',
9999
help: 'Total count of TCP listener errors by error type'
100100
}),
101-
events: context.metrics.registerCounterGroup(`libp2p_tcp_$${addr}_socket_events`, {
101+
events: context.metrics.registerCounterGroup(`libp2p_tcp_${addr}_socket_events_total`, {
102102
label: 'event',
103103
help: 'Total count of TCP socket events by event'
104104
})

0 commit comments

Comments
 (0)