forked from evstack/ev-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.go
More file actions
27 lines (21 loc) · 845 Bytes
/
setup.go
File metadata and controls
27 lines (21 loc) · 845 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
package node
import (
"time"
"github.com/evstack/ev-node/block"
"github.com/evstack/ev-node/pkg/config"
"github.com/evstack/ev-node/pkg/p2p"
)
const readHeaderTimeout = 10 * time.Second
// MetricsProvider returns a consensus, p2p and mempool Metrics.
type MetricsProvider func(chainID string) (*block.Metrics, *p2p.Metrics)
// DefaultMetricsProvider returns Metrics build using Prometheus client library
// if Prometheus is enabled. Otherwise, it returns no-op Metrics.
func DefaultMetricsProvider(config *config.InstrumentationConfig) MetricsProvider {
return func(chainID string) (*block.Metrics, *p2p.Metrics) {
if config.Prometheus {
return block.PrometheusMetrics(config.Namespace, "chain_id", chainID),
p2p.PrometheusMetrics(config.Namespace, "chain_id", chainID)
}
return block.NopMetrics(), p2p.NopMetrics()
}
}