mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-25 08:41:00 +00:00
Merge pull request #453 from prometheus/mr/guard-logger-fsm
mapper: Make sure we have a logger before backtracking check
This commit is contained in:
commit
af84364004
1 changed files with 4 additions and 4 deletions
|
@ -233,6 +233,10 @@ func (m *MetricMapper) InitFromYAMLString(fileContents string) error {
|
||||||
m.mutex.Lock()
|
m.mutex.Lock()
|
||||||
defer m.mutex.Unlock()
|
defer m.mutex.Unlock()
|
||||||
|
|
||||||
|
if m.Logger == nil {
|
||||||
|
m.Logger = log.NewNopLogger()
|
||||||
|
}
|
||||||
|
|
||||||
m.Defaults = n.Defaults
|
m.Defaults = n.Defaults
|
||||||
m.Mappings = n.Mappings
|
m.Mappings = n.Mappings
|
||||||
|
|
||||||
|
@ -259,10 +263,6 @@ func (m *MetricMapper) InitFromYAMLString(fileContents string) error {
|
||||||
m.MappingsCount.Set(float64(len(n.Mappings)))
|
m.MappingsCount.Set(float64(len(n.Mappings)))
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.Logger == nil {
|
|
||||||
m.Logger = log.NewNopLogger()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue