holepunch: add metrics (#2246)

* holepunch: add metrics

* don't track addresses

* add cancelled and no_suitable_address state

* separate holepunch dashbords by transport

* fix dashboard fields

* add instance filter to dashboard

* initialise metrics labels with 0

* fix panel names in dashboard

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
This commit is contained in:
Sukun
2023-06-05 18:11:26 +05:30
committed by GitHub
parent 6f27081cac
commit 73c34f98da
12 changed files with 1701 additions and 167 deletions
+6
View File
@@ -251,6 +251,12 @@ func NewHost(n network.Network, opts *HostOpts) (*BasicHost, error) {
}
if opts.EnableHolePunching {
if opts.EnableMetrics {
hpOpts := []holepunch.Option{
holepunch.WithMetricsTracer(holepunch.NewMetricsTracer(holepunch.WithRegisterer(opts.PrometheusRegisterer)))}
opts.HolePunchingOptions = append(hpOpts, opts.HolePunchingOptions...)
}
h.hps, err = holepunch.NewService(h, h.ids, opts.HolePunchingOptions...)
if err != nil {
return nil, fmt.Errorf("failed to create hole punch service: %w", err)