-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathmetrics.ts
More file actions
32 lines (26 loc) · 1018 Bytes
/
metrics.ts
File metadata and controls
32 lines (26 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import type { Metrics } from '@libp2p/interface-metrics'
export type MetricsRegistry = ReturnType<typeof registerMetrics>
export function registerMetrics (metrics: Metrics) {
return {
xxHandshakeSuccesses: metrics.registerCounter(
'libp2p_noise_xxhandshake_successes_total', {
help: 'Total count of noise xxHandshakes successes_'
}),
xxHandshakeErrors: metrics.registerCounter(
'libp2p_noise_xxhandshake_error_total', {
help: 'Total count of noise xxHandshakes errors'
}),
encryptedPackets: metrics.registerCounter(
'libp2p_noise_encrypted_packets_total', {
help: 'Total count of noise encrypted packets successfully'
}),
decryptedPackets: metrics.registerCounter(
'libp2p_noise_decrypted_packets_total', {
help: 'Total count of noise decrypted packets'
}),
decryptErrors: metrics.registerCounter(
'libp2p_noise_decrypt_errors_total', {
help: 'Total count of noise decrypt errors'
})
}
}