diff --git a/beacon/metrics/prometheus.go b/beacon/metrics/prometheus.go index 9a91f577ae..58cab50611 100644 --- a/beacon/metrics/prometheus.go +++ b/beacon/metrics/prometheus.go @@ -37,6 +37,12 @@ type BeaconMetricsCollector struct { calculatedBeaconWeight *prometheus.Desc } +var nameCalculatedWeight = prometheus.BuildFQName(metrics.Namespace, subsystem, "beacon_calculated_weight") + +func MetricNameCalculatedWeight() string { + return nameCalculatedWeight +} + // NewBeaconMetricsCollector creates a prometheus Collector for beacons. func NewBeaconMetricsCollector(cb GatherCB, logger log.Logger) *BeaconMetricsCollector { bmc := &BeaconMetricsCollector{ @@ -51,7 +57,7 @@ func NewBeaconMetricsCollector(cb GatherCB, logger log.Logger) *BeaconMetricsCol "Weight of beacons collected from blocks for each epoch and value", []string{labelEpoch, labelBeacon}, nil), calculatedBeaconWeight: prometheus.NewDesc( - prometheus.BuildFQName(metrics.Namespace, subsystem, "beacon_calculated_weight"), + nameCalculatedWeight, "Weight of the beacon calculated by the node for each epoch", []string{labelEpoch, labelBeacon}, nil), } diff --git a/log/logtest/log.go b/log/logtest/log.go index 27ea4331d4..eb84b39ff8 100644 --- a/log/logtest/log.go +++ b/log/logtest/log.go @@ -31,7 +31,7 @@ func New(tb testing.TB, override ...zapcore.Level) log.Log { panic(err) } } - return log.NewFromLog(zaptest.NewLogger(tb, zaptest.Level(level))) + return log.NewFromLog(zaptest.NewLogger(tb, zaptest.Level(level))).Named(tb.Name()) } // SetupGlobal updates AppLog to the instance of test-specific logger. diff --git a/log/zap.go b/log/zap.go index c0a67419ea..18b10aa641 100644 --- a/log/zap.go +++ b/log/zap.go @@ -85,6 +85,11 @@ func String(name, val string) Field { return Field(zap.String(name, val)) } +// Strings returns a strings Field. +func Strings(name string, val []string) Field { + return Field(zap.Strings(name, val)) +} + // Stringer returns an fmt.Sringer Field. func Stringer(name string, val fmt.Stringer) Field { return Field(zap.Stringer(name, val)) diff --git a/node/node.go b/node/node.go index c7486d906b..41cd43946f 100644 --- a/node/node.go +++ b/node/node.go @@ -323,7 +323,7 @@ func loadConfig(cfg *config.Config, preset, path string) error { viper.DecodeHook(hook), WithZeroFields(), WithIgnoreUntagged(), - withErrorUnused(), + WithErrorUnused(), } // load config if it was loaded to the viper @@ -345,7 +345,7 @@ func WithIgnoreUntagged() viper.DecoderConfigOption { } } -func withErrorUnused() viper.DecoderConfigOption { +func WithErrorUnused() viper.DecoderConfigOption { return func(cfg *mapstructure.DecoderConfig) { cfg.ErrorUnused = true }