mirror of
https://github.com/libp2p/go-libp2p.git
synced 2026-04-23 00:27:05 +08:00
relay service: add metrics (#2154)
* relay service: add metrics Metrics Added: ReservationRequest: Opened, Closed, Renewed ReservationRequestResponseStatus ReservationRejectionReason ConnectionRequest: Opened, Closed ConnectionRequestResponseStatus ConnectionRejectionReason ConnectionDuration BytesTransferred RelayStatus * add dashboard and changelog * bugfix * add metrics tests * address review comments * rename dashboard * address review comments * change label to rolling avg
This commit is contained in:
@@ -280,6 +280,13 @@ func NewHost(n network.Network, opts *HostOpts) (*BasicHost, error) {
|
||||
}
|
||||
|
||||
if opts.EnableRelayService {
|
||||
if opts.EnableMetrics {
|
||||
// Prefer explicitly provided metrics tracer
|
||||
metricsOpt := []relayv2.Option{
|
||||
relayv2.WithMetricsTracer(
|
||||
relayv2.NewMetricsTracer(relayv2.WithRegisterer(opts.PrometheusRegisterer)))}
|
||||
opts.RelayServiceOpts = append(metricsOpt, opts.RelayServiceOpts...)
|
||||
}
|
||||
h.relayManager = relaysvc.NewRelayManager(h, opts.RelayServiceOpts...)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user