diff options
author | Valery Piashchynski <[email protected]> | 2021-01-21 13:25:36 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-01-21 13:25:36 +0300 |
commit | 7da6c78449776e1f3c6716250bca0b712a0423a4 (patch) | |
tree | f3512de66aca2bba408485a0ea2fc936c0e4fb9b /plugins/metrics/plugin.go | |
parent | 0ff05b2732b4fd0783f959c94c54d7e39169f979 (diff) |
Uniform all configs
Add debug server
Check nil's for all plugin intialization
Diffstat (limited to 'plugins/metrics/plugin.go')
-rw-r--r-- | plugins/metrics/plugin.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/metrics/plugin.go b/plugins/metrics/plugin.go index 5ed1054e..859f3d24 100644 --- a/plugins/metrics/plugin.go +++ b/plugins/metrics/plugin.go @@ -30,7 +30,7 @@ type statsProvider struct { // Plugin to manage application metrics using Prometheus. type Plugin struct { - cfg Config + cfg *Config log logger.Logger mu sync.Mutex // all receivers are pointers http *http.Server @@ -41,12 +41,15 @@ type Plugin struct { // Init service. func (m *Plugin) Init(cfg config.Configurer, log logger.Logger) error { const op = errors.Op("metrics_plugin_init") + if !cfg.Has(PluginName) { + return errors.E(op, errors.Disabled) + } + err := cfg.UnmarshalKey(PluginName, &m.cfg) if err != nil { return errors.E(op, errors.Disabled, err) } - // TODO figure out what is Init m.cfg.InitDefaults() m.log = log |