Skip to content

Commit

Permalink
initialise dashboard values
Browse files Browse the repository at this point in the history
  • Loading branch information
sukunrt committed Jun 2, 2023
1 parent e6092dc commit 0d612bc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions p2p/protocol/holepunch/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ func NewMetricsTracer(opts ...MetricsTracerOption) MetricsTracer {
opt(setting)
}
metricshelper.RegisterCollectors(setting.reg, collectors...)
// initialise metrics's labels so that the first data point is handled correctly
for _, side := range []string{"initiator", "receiver"} {
for _, numAttempts := range []string{"1", "2", "3", "4"} {
for _, outcome := range []string{"success", "failed", "cancelled", "no_suitable_address"} {
for _, ipv := range []string{"ip4", "ip6"} {
for _, transport := range []string{"quic", "quic-v1", "tcp", "webtransport"} {
hpAddressOutcomesTotal.WithLabelValues(side, numAttempts, ipv, transport, outcome)
}
}
hpOutcomesTotal.WithLabelValues(side, numAttempts, outcome)
}
}
}
return &metricsTracer{}
}

Expand Down

0 comments on commit 0d612bc

Please sign in to comment.