diff options
author | Valery Piashchynski <[email protected]> | 2021-01-19 16:47:15 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-01-19 16:47:15 +0300 |
commit | 26f9d35e18ef79d79a5609c6c68f1b6ad38c7aed (patch) | |
tree | dd6224660ffd0dcefe2332807203ee1eaf6697b4 /plugins/metrics | |
parent | 75ebbaac89ce8ebc3ab8de47b16e137844cfcd8a (diff) |
Uniform all errors operations
Add new ExecTTL event
Update tests
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/metrics')
-rw-r--r-- | plugins/metrics/plugin.go | 2 | ||||
-rw-r--r-- | plugins/metrics/rpc.go | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/plugins/metrics/plugin.go b/plugins/metrics/plugin.go index fb9096a1..5ed1054e 100644 --- a/plugins/metrics/plugin.go +++ b/plugins/metrics/plugin.go @@ -40,7 +40,7 @@ type Plugin struct { // Init service. func (m *Plugin) Init(cfg config.Configurer, log logger.Logger) error { - const op = errors.Op("metrics init") + const op = errors.Op("metrics_plugin_init") err := cfg.UnmarshalKey(PluginName, &m.cfg) if err != nil { return errors.E(op, errors.Disabled, err) diff --git a/plugins/metrics/rpc.go b/plugins/metrics/rpc.go index f9c6accb..d7c90d39 100644 --- a/plugins/metrics/rpc.go +++ b/plugins/metrics/rpc.go @@ -25,7 +25,7 @@ type Metric struct { // Add new metric to the designated collector. func (rpc *rpcServer) Add(m *Metric, ok *bool) error { - const op = errors.Op("Add metric") + const op = errors.Op("metrics_plugin_add") rpc.log.Info("Adding metric", "name", m.Name, "value", m.Value, "labels", m.Labels) c, exist := rpc.svc.collectors.Load(m.Name) if !exist { @@ -76,7 +76,7 @@ func (rpc *rpcServer) Add(m *Metric, ok *bool) error { // Sub subtract the value from the specific metric (gauge only). func (rpc *rpcServer) Sub(m *Metric, ok *bool) error { - const op = errors.Op("Subtracting metric") + const op = errors.Op("metrics_plugin_sub") rpc.log.Info("Subtracting value from metric", "name", m.Name, "value", m.Value, "labels", m.Labels) c, exist := rpc.svc.collectors.Load(m.Name) if !exist { @@ -115,7 +115,7 @@ func (rpc *rpcServer) Sub(m *Metric, ok *bool) error { // Observe the value (histogram and summary only). func (rpc *rpcServer) Observe(m *Metric, ok *bool) error { - const op = errors.Op("Observe metrics") + const op = errors.Op("metrics_plugin_observe") rpc.log.Info("Observing metric", "name", m.Name, "value", m.Value, "labels", m.Labels) c, exist := rpc.svc.collectors.Load(m.Name) @@ -170,7 +170,7 @@ func (rpc *rpcServer) Observe(m *Metric, ok *bool) error { // RETURNS: // error func (rpc *rpcServer) Declare(nc *NamedCollector, ok *bool) error { - const op = errors.Op("Declare metric") + const op = errors.Op("metrics_plugin_declare") rpc.log.Info("Declaring new metric", "name", nc.Name, "type", nc.Type, "namespace", nc.Namespace) _, exist := rpc.svc.collectors.Load(nc.Name) if exist { @@ -255,7 +255,7 @@ func (rpc *rpcServer) Declare(nc *NamedCollector, ok *bool) error { // Set the metric value (only for gaude). func (rpc *rpcServer) Set(m *Metric, ok *bool) (err error) { - const op = errors.Op("Set metric") + const op = errors.Op("metrics_plugin_set") rpc.log.Info("Observing metric", "name", m.Name, "value", m.Value, "labels", m.Labels) c, exist := rpc.svc.collectors.Load(m.Name) |