DefaultMetricsProvider returns Metrics build using Prometheus client library if Prometheus is enabled. Otherwise, it returns no-op Metrics.
(config *cfg.InstrumentationConfig)
| 149 | // DefaultMetricsProvider returns Metrics build using Prometheus client library |
| 150 | // if Prometheus is enabled. Otherwise, it returns no-op Metrics. |
| 151 | func DefaultMetricsProvider(config *cfg.InstrumentationConfig) MetricsProvider { |
| 152 | return func(chainID string) (*consensus.Metrics, *p2p.Metrics, *mempl.Metrics, *sm.Metrics) { |
| 153 | if config.Prometheus { |
| 154 | return consensus.PrometheusMetrics(config.Namespace, "chain_id", chainID), |
| 155 | p2p.PrometheusMetrics(config.Namespace, "chain_id", chainID), |
| 156 | mempl.PrometheusMetrics(config.Namespace, "chain_id", chainID), |
| 157 | sm.PrometheusMetrics(config.Namespace, "chain_id", chainID) |
| 158 | } |
| 159 | return consensus.NopMetrics(), p2p.NopMetrics(), mempl.NopMetrics(), sm.NopMetrics() |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | // Option sets a parameter for the node. |
| 164 | type Option func(*Node) |
no test coverage detected