summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/checker/plugin.go8
-rw-r--r--plugins/checker/rpc.go2
-rwxr-xr-xplugins/config/plugin.go6
-rw-r--r--plugins/headers/plugin.go2
-rw-r--r--plugins/http/handler.go2
-rw-r--r--plugins/http/plugin.go8
-rw-r--r--plugins/informer/plugin.go2
-rw-r--r--plugins/kv/boltdb/plugin.go22
-rw-r--r--plugins/kv/boltdb/plugin_unit_test.go2
-rw-r--r--plugins/kv/memcached/plugin.go16
-rw-r--r--plugins/kv/memory/plugin.go18
-rw-r--r--plugins/metrics/plugin.go2
-rw-r--r--plugins/metrics/rpc.go10
-rw-r--r--plugins/redis/plugin.go2
-rw-r--r--plugins/reload/config.go2
-rw-r--r--plugins/reload/plugin.go4
-rw-r--r--plugins/reload/watcher.go6
-rw-r--r--plugins/resetter/plugin.go4
-rw-r--r--plugins/server/plugin.go34
-rw-r--r--plugins/static/config.go2
-rw-r--r--plugins/static/plugin.go2
21 files changed, 78 insertions, 78 deletions
diff --git a/plugins/checker/plugin.go b/plugins/checker/plugin.go
index 95f4f68c..ef184b02 100644
--- a/plugins/checker/plugin.go
+++ b/plugins/checker/plugin.go
@@ -26,7 +26,7 @@ type Plugin struct {
}
func (c *Plugin) Init(log logger.Logger, cfg config.Configurer) error {
- const op = errors.Op("status plugin init")
+ const op = errors.Op("checker_plugin_init")
err := cfg.UnmarshalKey(PluginName, &c.cfg)
if err != nil {
return errors.E(op, errors.Disabled, err)
@@ -63,7 +63,7 @@ func (c *Plugin) Serve() chan error {
}
func (c *Plugin) Stop() error {
- const op = errors.Op("checker stop")
+ const op = errors.Op("checker_plugin_stop")
err := c.server.Shutdown()
if err != nil {
return errors.E(op, err)
@@ -73,7 +73,7 @@ func (c *Plugin) Stop() error {
// Reset named service.
func (c *Plugin) Status(name string) (Status, error) {
- const op = errors.Op("get status")
+ const op = errors.Op("checker_plugin_status")
svc, ok := c.registry[name]
if !ok {
return Status{}, errors.E(op, errors.Errorf("no such service: %s", name))
@@ -112,7 +112,7 @@ type Plugins struct {
const template string = "Service: %s: Status: %d\n"
func (c *Plugin) healthHandler(ctx *fiber.Ctx) error {
- const op = errors.Op("health_handler")
+ const op = errors.Op("checker_plugin_health_handler")
plugins := &Plugins{}
err := ctx.QueryParser(plugins)
if err != nil {
diff --git a/plugins/checker/rpc.go b/plugins/checker/rpc.go
index 0daa62fe..a965dcd4 100644
--- a/plugins/checker/rpc.go
+++ b/plugins/checker/rpc.go
@@ -12,7 +12,7 @@ type rpc struct {
// Status return current status of the provided plugin
func (rpc *rpc) Status(service string, status *Status) error {
- const op = errors.Op("status")
+ const op = errors.Op("checker_rpc_status")
rpc.log.Debug("started Status method", "service", service)
st, err := rpc.srv.Status(service)
if err != nil {
diff --git a/plugins/config/plugin.go b/plugins/config/plugin.go
index 9cecf9f9..ce2baa85 100755
--- a/plugins/config/plugin.go
+++ b/plugins/config/plugin.go
@@ -18,7 +18,7 @@ type Viper struct {
// Inits config provider.
func (v *Viper) Init() error {
- const op = errors.Op("viper plugin init")
+ const op = errors.Op("config_plugin_init")
v.viper = viper.New()
// If user provided []byte data with config, read it and ignore Path and Prefix
if v.ReadInCfg != nil && v.Type != "" {
@@ -56,7 +56,7 @@ func (v *Viper) Overwrite(values map[string]interface{}) error {
// UnmarshalKey reads configuration section into configuration object.
func (v *Viper) UnmarshalKey(name string, out interface{}) error {
- const op = errors.Op("unmarshal key")
+ const op = errors.Op("config_plugin_unmarshal_key")
err := v.viper.UnmarshalKey(name, &out)
if err != nil {
return errors.E(op, err)
@@ -65,7 +65,7 @@ func (v *Viper) UnmarshalKey(name string, out interface{}) error {
}
func (v *Viper) Unmarshal(out interface{}) error {
- const op = errors.Op("config unmarshal")
+ const op = errors.Op("config_plugin_unmarshal")
err := v.viper.Unmarshal(&out)
if err != nil {
return errors.E(op, err)
diff --git a/plugins/headers/plugin.go b/plugins/headers/plugin.go
index f1c6e6f3..3f25a1ed 100644
--- a/plugins/headers/plugin.go
+++ b/plugins/headers/plugin.go
@@ -21,7 +21,7 @@ type Plugin struct {
// Init must return configure service and return true if service hasStatus enabled. Must return error in case of
// misconfiguration. Services must not be used without proper configuration pushed first.
func (s *Plugin) Init(cfg config.Configurer) error {
- const op = errors.Op("headers plugin init")
+ const op = errors.Op("headers_plugin_init")
err := cfg.UnmarshalKey(RootPluginName, &s.cfg)
if err != nil {
return errors.E(op, errors.Disabled, err)
diff --git a/plugins/http/handler.go b/plugins/http/handler.go
index 1c7f79e3..3e21ab2b 100644
--- a/plugins/http/handler.go
+++ b/plugins/http/handler.go
@@ -97,7 +97,7 @@ func (h *Handler) AddListener(l events.Listener) {
// mdwr serve using PSR-7 requests passed to underlying application. Attempts to serve static files first if enabled.
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
- const op = errors.Op("ServeHTTP")
+ const op = errors.Op("http_plugin_serve_http")
start := time.Now()
// validating request size
diff --git a/plugins/http/plugin.go b/plugins/http/plugin.go
index f35c321b..d9c1729e 100644
--- a/plugins/http/plugin.go
+++ b/plugins/http/plugin.go
@@ -71,7 +71,7 @@ type Plugin struct {
// Init must return configure svc and return true if svc hasStatus enabled. Must return error in case of
// misconfiguration. Services must not be used without proper configuration pushed first.
func (s *Plugin) Init(cfg config.Configurer, log logger.Logger, server server.Server) error {
- const op = errors.Op("http plugin init")
+ const op = errors.Op("http_plugin_init")
err := cfg.UnmarshalKey(PluginName, &s.cfg)
if err != nil {
return errors.E(op, err)
@@ -135,7 +135,7 @@ func (s *Plugin) Serve() chan error {
s.Lock()
defer s.Unlock()
- const op = errors.Op("serve http")
+ const op = errors.Op("http_plugin_serve")
errCh := make(chan error, 2)
var err error
@@ -298,7 +298,7 @@ func (s *Plugin) Name() string {
func (s *Plugin) Reset() error {
s.Lock()
defer s.Unlock()
- const op = errors.Op("http reset")
+ const op = errors.Op("http_plugin_reset")
s.log.Info("HTTP plugin got restart request. Restarting...")
s.pool.Destroy(context.Background())
s.pool = nil
@@ -387,7 +387,7 @@ func headerContainsUpgrade(r *http.Request, s *Plugin) bool {
// append RootCA to the https server TLS config
func (s *Plugin) appendRootCa() error {
- const op = errors.Op("append root CA")
+ const op = errors.Op("http_plugin_append_root_ca")
rootCAs, err := x509.SystemCertPool()
if err != nil {
return nil
diff --git a/plugins/informer/plugin.go b/plugins/informer/plugin.go
index 3359cd7e..3391ee01 100644
--- a/plugins/informer/plugin.go
+++ b/plugins/informer/plugin.go
@@ -22,7 +22,7 @@ func (p *Plugin) Init(log logger.Logger) error {
// Workers provides BaseProcess slice with workers for the requested plugin
func (p *Plugin) Workers(name string) ([]worker.BaseProcess, error) {
- const op = errors.Op("get workers")
+ const op = errors.Op("informer_plugin_workers")
svc, ok := p.registry[name]
if !ok {
return nil, errors.E(op, errors.Errorf("no such service: %s", name))
diff --git a/plugins/kv/boltdb/plugin.go b/plugins/kv/boltdb/plugin.go
index 6cfc49f6..683d6fc5 100644
--- a/plugins/kv/boltdb/plugin.go
+++ b/plugins/kv/boltdb/plugin.go
@@ -41,7 +41,7 @@ type Plugin struct {
}
func (s *Plugin) Init(log logger.Logger, cfg config.Configurer) error {
- const op = errors.Op("boltdb plugin init")
+ const op = errors.Op("boltdb_plugin_init")
s.cfg = &Config{}
s.cfg.InitDefaults()
@@ -62,7 +62,7 @@ func (s *Plugin) Init(log logger.Logger, cfg config.Configurer) error {
// create bucket if it does not exist
// tx.Commit invokes via the db.Update
err = db.Update(func(tx *bolt.Tx) error {
- const upOp = errors.Op("boltdb Update")
+ const upOp = errors.Op("boltdb_plugin_update")
_, err = tx.CreateBucketIfNotExists([]byte(s.cfg.Bucket))
if err != nil {
return errors.E(op, upOp)
@@ -92,7 +92,7 @@ func (s *Plugin) Serve() chan error {
}
func (s *Plugin) Stop() error {
- const op = errors.Op("boltdb stop")
+ const op = errors.Op("boltdb_plugin_stop")
err := s.Close()
if err != nil {
return errors.E(op, err)
@@ -101,7 +101,7 @@ func (s *Plugin) Stop() error {
}
func (s *Plugin) Has(keys ...string) (map[string]bool, error) {
- const op = errors.Op("boltdb Has")
+ const op = errors.Op("boltdb_plugin_has")
s.log.Debug("boltdb HAS method called", "args", keys)
if keys == nil {
return nil, errors.E(op, errors.NoKeys)
@@ -142,7 +142,7 @@ func (s *Plugin) Has(keys ...string) (map[string]bool, error) {
// Returns a nil value if the key does not exist or if the key is a nested bucket.
// The returned value is only valid for the life of the transaction.
func (s *Plugin) Get(key string) ([]byte, error) {
- const op = errors.Op("boltdb Get")
+ const op = errors.Op("boltdb_plugin_get")
// to get cases like " "
keyTrimmed := strings.TrimSpace(key)
if keyTrimmed == "" {
@@ -182,7 +182,7 @@ func (s *Plugin) Get(key string) ([]byte, error) {
}
func (s *Plugin) MGet(keys ...string) (map[string]interface{}, error) {
- const op = errors.Op("boltdb MGet")
+ const op = errors.Op("boltdb_plugin_mget")
// defence
if keys == nil {
return nil, errors.E(op, errors.NoKeys)
@@ -234,7 +234,7 @@ func (s *Plugin) MGet(keys ...string) (map[string]interface{}, error) {
// Set puts the K/V to the bolt
func (s *Plugin) Set(items ...kv.Item) error {
- const op = errors.Op("boltdb Set")
+ const op = errors.Op("boltdb_plugin_set")
if items == nil {
return errors.E(op, errors.NoKeys)
}
@@ -297,7 +297,7 @@ func (s *Plugin) Set(items ...kv.Item) error {
// Delete all keys from DB
func (s *Plugin) Delete(keys ...string) error {
- const op = errors.Op("boltdb Delete")
+ const op = errors.Op("boltdb_plugin_delete")
if keys == nil {
return errors.E(op, errors.NoKeys)
}
@@ -344,7 +344,7 @@ func (s *Plugin) Delete(keys ...string) error {
// MExpire sets the expiration time to the key
// If key already has the expiration time, it will be overwritten
func (s *Plugin) MExpire(items ...kv.Item) error {
- const op = errors.Op("boltdb MExpire")
+ const op = errors.Op("boltdb_plugin_mexpire")
for i := range items {
if items[i].TTL == "" || strings.TrimSpace(items[i].Key) == "" {
return errors.E(op, errors.Str("should set timeout and at least one key"))
@@ -362,7 +362,7 @@ func (s *Plugin) MExpire(items ...kv.Item) error {
}
func (s *Plugin) TTL(keys ...string) (map[string]interface{}, error) {
- const op = errors.Op("boltdb TTL")
+ const op = errors.Op("boltdb_plugin_ttl")
if keys == nil {
return nil, errors.E(op, errors.NoKeys)
}
@@ -414,7 +414,7 @@ func (s *Plugin) gcPhase() {
// calculate current time before loop started to be fair
now := time.Now()
s.gc.Range(func(key, value interface{}) bool {
- const op = errors.Op("gcPhase")
+ const op = errors.Op("boltdb_plugin_gc")
k := key.(string)
v, err := time.Parse(time.RFC3339, value.(string))
if err != nil {
diff --git a/plugins/kv/boltdb/plugin_unit_test.go b/plugins/kv/boltdb/plugin_unit_test.go
index fa12db8c..890736f7 100644
--- a/plugins/kv/boltdb/plugin_unit_test.go
+++ b/plugins/kv/boltdb/plugin_unit_test.go
@@ -22,7 +22,7 @@ import (
// options *bolt.Options -- boltDB options, such as timeouts, noGrows options and other
// bucket string -- name of the bucket to use, should be UTF-8
func newBoltClient(path string, perm os.FileMode, options *bolt.Options, bucket string, ttl time.Duration) (kv.Storage, error) {
- const op = errors.Op("newBoltClient")
+ const op = errors.Op("boltdb_plugin_new_bolt_client")
db, err := bolt.Open(path, perm, options)
if err != nil {
return nil, errors.E(op, err)
diff --git a/plugins/kv/memcached/plugin.go b/plugins/kv/memcached/plugin.go
index 05159b33..e8b05567 100644
--- a/plugins/kv/memcached/plugin.go
+++ b/plugins/kv/memcached/plugin.go
@@ -35,7 +35,7 @@ func NewMemcachedClient(url string) kv.Storage {
}
func (s *Plugin) Init(log logger.Logger, cfg config.Configurer) error {
- const op = errors.Op("memcached init")
+ const op = errors.Op("memcached_plugin_init")
s.cfg = &Config{}
s.cfg.InitDefaults()
err := cfg.UnmarshalKey(PluginName, &s.cfg)
@@ -69,7 +69,7 @@ func (s *Plugin) Name() string {
// Has checks the key for existence
func (s *Plugin) Has(keys ...string) (map[string]bool, error) {
- const op = errors.Op("memcached Has")
+ const op = errors.Op("memcached_plugin_has")
if keys == nil {
return nil, errors.E(op, errors.NoKeys)
}
@@ -94,7 +94,7 @@ func (s *Plugin) Has(keys ...string) (map[string]bool, error) {
// Get gets the item for the given key. ErrCacheMiss is returned for a
// memcache cache miss. The key must be at most 250 bytes in length.
func (s *Plugin) Get(key string) ([]byte, error) {
- const op = errors.Op("memcached Get")
+ const op = errors.Op("memcached_plugin_get")
// to get cases like " "
keyTrimmed := strings.TrimSpace(key)
if keyTrimmed == "" {
@@ -116,7 +116,7 @@ func (s *Plugin) Get(key string) ([]byte, error) {
// return map with key -- string
// and map value as value -- []byte
func (s *Plugin) MGet(keys ...string) (map[string]interface{}, error) {
- const op = errors.Op("memcached MGet")
+ const op = errors.Op("memcached_plugin_mget")
if keys == nil {
return nil, errors.E(op, errors.NoKeys)
}
@@ -151,7 +151,7 @@ func (s *Plugin) MGet(keys ...string) (map[string]interface{}, error) {
// time from now (up to 1 month), or an absolute Unix epoch time.
// Zero means the Item has no expiration time.
func (s *Plugin) Set(items ...kv.Item) error {
- const op = errors.Op("memcached Set")
+ const op = errors.Op("memcached_plugin_set")
if items == nil {
return errors.E(op, errors.NoKeys)
}
@@ -192,7 +192,7 @@ func (s *Plugin) Set(items ...kv.Item) error {
// time from now (up to 1 month), or an absolute Unix epoch time.
// Zero means the Item has no expiration time.
func (s *Plugin) MExpire(items ...kv.Item) error {
- const op = errors.Op("memcached MExpire")
+ const op = errors.Op("memcached_plugin_mexpire")
for i := range items {
if items[i].TTL == "" || strings.TrimSpace(items[i].Key) == "" {
return errors.E(op, errors.Str("should set timeout and at least one key"))
@@ -219,12 +219,12 @@ func (s *Plugin) MExpire(items ...kv.Item) error {
// return time in seconds (int32) for a given keys
func (s *Plugin) TTL(keys ...string) (map[string]interface{}, error) {
- const op = errors.Op("memcached HTTLas")
+ const op = errors.Op("memcached_plugin_ttl")
return nil, errors.E(op, errors.Str("not valid request for memcached, see https://github.com/memcached/memcached/issues/239"))
}
func (s *Plugin) Delete(keys ...string) error {
- const op = errors.Op("memcached Has")
+ const op = errors.Op("memcached_plugin_has")
if keys == nil {
return errors.E(op, errors.NoKeys)
}
diff --git a/plugins/kv/memory/plugin.go b/plugins/kv/memory/plugin.go
index d2d3721b..ddcf88a9 100644
--- a/plugins/kv/memory/plugin.go
+++ b/plugins/kv/memory/plugin.go
@@ -24,7 +24,7 @@ type Plugin struct {
}
func (s *Plugin) Init(cfg config.Configurer, log logger.Logger) error {
- const op = errors.Op("in-memory storage init")
+ const op = errors.Op("in_memory_plugin_init")
s.cfg = &Config{}
s.cfg.InitDefaults()
@@ -47,7 +47,7 @@ func (s *Plugin) Serve() chan error {
}
func (s *Plugin) Stop() error {
- const op = errors.Op("in-memory storage stop")
+ const op = errors.Op("in_memory_plugin_stop")
err := s.Close()
if err != nil {
return errors.E(op, err)
@@ -56,7 +56,7 @@ func (s *Plugin) Stop() error {
}
func (s *Plugin) Has(keys ...string) (map[string]bool, error) {
- const op = errors.Op("in-memory storage Has")
+ const op = errors.Op("in_memory_plugin_has")
if keys == nil {
return nil, errors.E(op, errors.NoKeys)
}
@@ -76,7 +76,7 @@ func (s *Plugin) Has(keys ...string) (map[string]bool, error) {
}
func (s *Plugin) Get(key string) ([]byte, error) {
- const op = errors.Op("in-memory storage Get")
+ const op = errors.Op("in_memory_plugin_get")
// to get cases like " "
keyTrimmed := strings.TrimSpace(key)
if keyTrimmed == "" {
@@ -92,7 +92,7 @@ func (s *Plugin) Get(key string) ([]byte, error) {
}
func (s *Plugin) MGet(keys ...string) (map[string]interface{}, error) {
- const op = errors.Op("in-memory storage MGet")
+ const op = errors.Op("in_memory_plugin_mget")
if keys == nil {
return nil, errors.E(op, errors.NoKeys)
}
@@ -117,7 +117,7 @@ func (s *Plugin) MGet(keys ...string) (map[string]interface{}, error) {
}
func (s *Plugin) Set(items ...kv.Item) error {
- const op = errors.Op("in-memory storage Set")
+ const op = errors.Op("in_memory_plugin_set")
if items == nil {
return errors.E(op, errors.NoKeys)
}
@@ -140,7 +140,7 @@ func (s *Plugin) Set(items ...kv.Item) error {
// MExpire sets the expiration time to the key
// If key already has the expiration time, it will be overwritten
func (s *Plugin) MExpire(items ...kv.Item) error {
- const op = errors.Op("in-memory storage MExpire")
+ const op = errors.Op("in_memory_plugin_mexpire")
for i := range items {
if items[i].TTL == "" || strings.TrimSpace(items[i].Key) == "" {
return errors.E(op, errors.Str("should set timeout and at least one key"))
@@ -169,7 +169,7 @@ func (s *Plugin) MExpire(items ...kv.Item) error {
}
func (s *Plugin) TTL(keys ...string) (map[string]interface{}, error) {
- const op = errors.Op("in-memory storage TTL")
+ const op = errors.Op("in_memory_plugin_ttl")
if keys == nil {
return nil, errors.E(op, errors.NoKeys)
}
@@ -193,7 +193,7 @@ func (s *Plugin) TTL(keys ...string) (map[string]interface{}, error) {
}
func (s *Plugin) Delete(keys ...string) error {
- const op = errors.Op("in-memory storage Delete")
+ const op = errors.Op("in_memory_plugin_delete")
if keys == nil {
return errors.E(op, errors.NoKeys)
}
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)
diff --git a/plugins/redis/plugin.go b/plugins/redis/plugin.go
index fe465340..06158b43 100644
--- a/plugins/redis/plugin.go
+++ b/plugins/redis/plugin.go
@@ -23,7 +23,7 @@ func (s *Plugin) GetClient() redis.UniversalClient {
}
func (s *Plugin) Init(cfg config.Configurer, log logger.Logger) error {
- const op = errors.Op("redis plugin init")
+ const op = errors.Op("redis_plugin_init")
s.cfg = &Config{}
s.cfg.InitDefaults()
diff --git a/plugins/reload/config.go b/plugins/reload/config.go
index 9ca2c0dc..9bce6b25 100644
--- a/plugins/reload/config.go
+++ b/plugins/reload/config.go
@@ -43,7 +43,7 @@ func InitDefaults(c *Config) {
// Valid validates the configuration.
func (c *Config) Valid() error {
- const op = errors.Op("config validation [reload plugin]")
+ const op = errors.Op("reload_plugin_valid")
if c.Interval < time.Second {
return errors.E(op, errors.Str("too short interval"))
}
diff --git a/plugins/reload/plugin.go b/plugins/reload/plugin.go
index eb1b61b2..93760b8a 100644
--- a/plugins/reload/plugin.go
+++ b/plugins/reload/plugin.go
@@ -26,7 +26,7 @@ type Plugin struct {
// Init controller service
func (s *Plugin) Init(cfg config.Configurer, log logger.Logger, res resetter.Resetter) error {
- const op = errors.Op("reload plugin init")
+ const op = errors.Op("reload_plugin_init")
s.cfg = &Config{}
InitDefaults(s.cfg)
err := cfg.UnmarshalKey(PluginName, &s.cfg)
@@ -74,7 +74,7 @@ func (s *Plugin) Init(cfg config.Configurer, log logger.Logger, res resetter.Res
}
func (s *Plugin) Serve() chan error {
- const op = errors.Op("reload plugin serve")
+ const op = errors.Op("reload_plugin_serve")
errCh := make(chan error, 1)
if s.cfg.Interval < time.Second {
errCh <- errors.E(op, errors.Str("reload interval is too fast"))
diff --git a/plugins/reload/watcher.go b/plugins/reload/watcher.go
index 08c85af9..8dde38de 100644
--- a/plugins/reload/watcher.go
+++ b/plugins/reload/watcher.go
@@ -102,7 +102,7 @@ func NewWatcher(configs []WatcherConfig, log logger.Logger, options ...Options)
// initFs makes initial map with files
func (w *Watcher) initFs() error {
- const op = errors.Op("init fs")
+ const op = errors.Op("watcher_init_fs")
for srvName, config := range w.watcherConfigs {
fileList, err := w.retrieveFileList(srvName, config)
if err != nil {
@@ -148,7 +148,7 @@ func ConvertIgnored(ignored []string) (map[string]struct{}, error) {
// pass map from outside
func (w *Watcher) retrieveFilesSingle(serviceName, path string) (map[string]os.FileInfo, error) {
- const op = errors.Op("retrieve")
+ const op = errors.Op("watcher_retrieve_files_single")
stat, err := os.Stat(path)
if err != nil {
return nil, err
@@ -192,7 +192,7 @@ outer:
func (w *Watcher) StartPolling(duration time.Duration) error {
w.mu.Lock()
- const op = errors.Op("start polling")
+ const op = errors.Op("watcher_start_polling")
if w.started {
w.mu.Unlock()
return errors.E(op, errors.Str("already started"))
diff --git a/plugins/resetter/plugin.go b/plugins/resetter/plugin.go
index 5d294086..611cb363 100644
--- a/plugins/resetter/plugin.go
+++ b/plugins/resetter/plugin.go
@@ -14,7 +14,7 @@ type Plugin struct {
}
func (p *Plugin) ResetAll() error {
- const op = errors.Op("reset all")
+ const op = errors.Op("resetter_plugin_reset_all")
for name := range p.registry {
err := p.registry[name].Reset()
if err != nil {
@@ -25,7 +25,7 @@ func (p *Plugin) ResetAll() error {
}
func (p *Plugin) ResetByName(plugin string) error {
- const op = errors.Op("reset by name")
+ const op = errors.Op("resetter_plugin_reset_by_name")
if plugin, ok := p.registry[plugin]; ok {
return plugin.Reset()
}
diff --git a/plugins/server/plugin.go b/plugins/server/plugin.go
index 721cbd0f..e4f7c577 100644
--- a/plugins/server/plugin.go
+++ b/plugins/server/plugin.go
@@ -38,7 +38,7 @@ type Plugin struct {
// Init application provider.
func (server *Plugin) Init(cfg config.Configurer, log logger.Logger) error {
- const op = errors.Op("server plugin init")
+ const op = errors.Op("server_plugin_init")
err := cfg.Unmarshal(&server.cfg)
if err != nil {
return errors.E(op, errors.Init, err)
@@ -76,7 +76,7 @@ func (server *Plugin) Stop() error {
// CmdFactory provides worker command factory associated with given context.
func (server *Plugin) CmdFactory(env Env) (func() *exec.Cmd, error) {
- const op = errors.Op("cmd factory")
+ const op = errors.Op("server_plugin_cmd_factory")
var cmdArgs []string
// create command according to the config
@@ -113,7 +113,7 @@ func (server *Plugin) CmdFactory(env Env) (func() *exec.Cmd, error) {
// NewWorker issues new standalone worker.
func (server *Plugin) NewWorker(ctx context.Context, env Env, listeners ...events.Listener) (worker.BaseProcess, error) {
- const op = errors.Op("new worker")
+ const op = errors.Op("server_plugin_new_worker")
list := make([]events.Listener, 0, len(listeners))
list = append(list, server.collectWorkerLogs)
@@ -133,7 +133,7 @@ func (server *Plugin) NewWorker(ctx context.Context, env Env, listeners ...event
// NewWorkerPool issues new worker pool.
func (server *Plugin) NewWorkerPool(ctx context.Context, opt poolImpl.Config, env Env, listeners ...events.Listener) (pool.Pool, error) {
- const op = errors.Op("server plugins new worker pool")
+ const op = errors.Op("server_plugin_new_worker_pool")
spawnCmd, err := server.CmdFactory(env)
if err != nil {
return nil, errors.E(op, err)
@@ -155,7 +155,7 @@ func (server *Plugin) NewWorkerPool(ctx context.Context, opt poolImpl.Config, en
// creates relay and worker factory.
func (server *Plugin) initFactory() (worker.Factory, error) {
- const op = errors.Op("server factory init")
+ const op = errors.Op("server_plugin_init_factory")
if server.cfg.Server.Relay == "" || server.cfg.Server.Relay == "pipes" {
return pipe.NewPipeFactory(), nil
}
@@ -205,36 +205,36 @@ func (server *Plugin) collectPoolLogs(event interface{}) {
if we, ok := event.(events.PoolEvent); ok {
switch we.Event {
case events.EventMaxMemory:
- server.log.Info("worker max memory reached", "pid", we.Payload.(worker.BaseProcess).Pid())
+ server.log.Warn("worker max memory reached", "pid", we.Payload.(worker.BaseProcess).Pid())
case events.EventNoFreeWorkers:
- server.log.Info("no free workers in pool", "error", we.Payload.(error).Error())
+ server.log.Warn("no free workers in pool", "error", we.Payload.(error).Error())
case events.EventPoolError:
- server.log.Info("pool error", "error", we.Payload.(error).Error())
+ server.log.Error("pool error", "error", we.Payload.(error).Error())
case events.EventSupervisorError:
- server.log.Info("pool supervisor error", "error", we.Payload.(error).Error())
+ server.log.Error("pool supervisor error", "error", we.Payload.(error).Error())
case events.EventTTL:
- server.log.Info("worker TTL reached", "pid", we.Payload.(worker.BaseProcess).Pid())
+ server.log.Warn("worker TTL reached", "pid", we.Payload.(worker.BaseProcess).Pid())
case events.EventWorkerConstruct:
if _, ok := we.Payload.(error); ok {
server.log.Error("worker construction error", "error", we.Payload.(error).Error())
return
}
- server.log.Info("worker constructed", "pid", we.Payload.(worker.BaseProcess).Pid())
+ server.log.Debug("worker constructed", "pid", we.Payload.(worker.BaseProcess).Pid())
case events.EventWorkerDestruct:
- server.log.Info("worker destructed", "pid", we.Payload.(worker.BaseProcess).Pid())
+ server.log.Debug("worker destructed", "pid", we.Payload.(worker.BaseProcess).Pid())
case events.EventExecTTL:
- server.log.Info("EVENT EXEC TTL PLACEHOLDER")
+ server.log.Warn("worker exec timeout reached", "error", we.Payload.(error).Error())
case events.EventIdleTTL:
- server.log.Info("worker IDLE timeout reached", "pid", we.Payload.(worker.BaseProcess).Pid())
+ server.log.Warn("worker idle timeout reached", "pid", we.Payload.(worker.BaseProcess).Pid())
}
}
if we, ok := event.(events.WorkerEvent); ok {
switch we.Event {
case events.EventWorkerError:
- server.log.Info(we.Payload.(error).Error(), "pid", we.Worker.(worker.BaseProcess).Pid())
+ server.log.Error(we.Payload.(error).Error(), "pid", we.Worker.(worker.BaseProcess).Pid())
case events.EventWorkerLog:
- server.log.Info(strings.TrimRight(string(we.Payload.([]byte)), " \n\t"), "pid", we.Worker.(worker.BaseProcess).Pid())
+ server.log.Debug(strings.TrimRight(string(we.Payload.([]byte)), " \n\t"), "pid", we.Worker.(worker.BaseProcess).Pid())
}
}
}
@@ -245,7 +245,7 @@ func (server *Plugin) collectWorkerLogs(event interface{}) {
case events.EventWorkerError:
server.log.Error(we.Payload.(error).Error(), "pid", we.Worker.(worker.BaseProcess).Pid())
case events.EventWorkerLog:
- server.log.Info(strings.TrimRight(string(we.Payload.([]byte)), " \n\t"), "pid", we.Worker.(worker.BaseProcess).Pid())
+ server.log.Debug(strings.TrimRight(string(we.Payload.([]byte)), " \n\t"), "pid", we.Worker.(worker.BaseProcess).Pid())
}
}
}
diff --git a/plugins/static/config.go b/plugins/static/config.go
index f5d26b2d..17a82cfd 100644
--- a/plugins/static/config.go
+++ b/plugins/static/config.go
@@ -32,7 +32,7 @@ type Config struct {
// Valid returns nil if config is valid.
func (c *Config) Valid() error {
- const op = errors.Op("static plugin validation")
+ const op = errors.Op("static_plugin_valid")
st, err := os.Stat(c.Static.Dir)
if err != nil {
if os.IsNotExist(err) {
diff --git a/plugins/static/plugin.go b/plugins/static/plugin.go
index 06b384df..6331037c 100644
--- a/plugins/static/plugin.go
+++ b/plugins/static/plugin.go
@@ -28,7 +28,7 @@ type Plugin struct {
// Init must return configure service and return true if service hasStatus enabled. Must return error in case of
// misconfiguration. Services must not be used without proper configuration pushed first.
func (s *Plugin) Init(cfg config.Configurer, log logger.Logger) error {
- const op = errors.Op("static plugin init")
+ const op = errors.Op("static_plugin_init")
err := cfg.UnmarshalKey(RootPluginName, &s.cfg)
if err != nil {
return errors.E(op, errors.Disabled, err)