-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
73 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2021 The Swarm Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package reacher | ||
|
||
import ( | ||
m "github.com/ethersphere/bee/pkg/metrics" | ||
"github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
type metrics struct { | ||
Pings prometheus.CounterVec | ||
PingTime prometheus.HistogramVec | ||
} | ||
|
||
func newMetrics() metrics { | ||
subsystem := "reacher" | ||
|
||
return metrics{ | ||
Pings: *prometheus.NewCounterVec(prometheus.CounterOpts{ | ||
Namespace: m.Namespace, | ||
Subsystem: subsystem, | ||
Name: "pings", | ||
Help: "Ping counter.", | ||
}, []string{"status"}), | ||
PingTime: *prometheus.NewHistogramVec(prometheus.HistogramOpts{ | ||
Namespace: m.Namespace, | ||
Subsystem: subsystem, | ||
Name: "ping_timer", | ||
Help: "Ping timer.", | ||
}, []string{"status"}), | ||
} | ||
} | ||
|
||
func (s *reacher) Metrics() []prometheus.Collector { | ||
return m.PrometheusCollectorsFromFields(s.metrics) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters