diff options
author | Valery Piashchynski <[email protected]> | 2021-01-19 18:10:39 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-19 18:10:39 +0300 |
commit | 0ff05b2732b4fd0783f959c94c54d7e39169f979 (patch) | |
tree | f50aa894ea4e5b402332f7f4a13b8c50ebb09126 | |
parent | 75ebbaac89ce8ebc3ab8de47b16e137844cfcd8a (diff) | |
parent | d8e42927b63a0b102ce10d465a10d64bb6c02e22 (diff) |
Merge pull request #487 from spiral/refactor/server_log_messagesv2.0.0-beta9
refactor(errors, logs): Uniform all errors operations, Update server log level of the server log messages
43 files changed, 174 insertions, 206 deletions
@@ -58,32 +58,32 @@ test_coverage: test: ## Run application tests docker-compose -f tests/docker-compose.yaml up -d - go test -v -race -cover -tags=debug -covermode=atomic ./utils - go test -v -race -cover -tags=debug -covermode=atomic ./pkg/pipe - go test -v -race -cover -tags=debug -covermode=atomic ./pkg/pool - go test -v -race -cover -tags=debug -covermode=atomic ./pkg/socket - go test -v -race -cover -tags=debug -covermode=atomic ./pkg/worker - go test -v -race -cover -tags=debug -covermode=atomic ./pkg/worker_watcher - go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/http - go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/informer - go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/reload - go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/server - go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/checker - go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/config - go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/gzip - go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/headers - go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/logger - go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/metrics - go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/redis - go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/resetter - go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/rpc - go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/static - go test -v -race -cover -tags=debug -covermode=atomic ./plugins/kv/boltdb - go test -v -race -cover -tags=debug -covermode=atomic ./plugins/kv/memory - go test -v -race -cover -tags=debug -covermode=atomic ./plugins/kv/memcached - go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/kv/boltdb - go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/kv/memory - go test -v -race -cover -tags=debug -covermode=atomic ./tests/plugins/kv/memcached + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./utils + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./pkg/pipe + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./pkg/pool + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./pkg/socket + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./pkg/worker + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./pkg/worker_watcher + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./tests/plugins/http + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./tests/plugins/informer + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./tests/plugins/reload + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./tests/plugins/server + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./tests/plugins/checker + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./tests/plugins/config + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./tests/plugins/gzip + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./tests/plugins/headers + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./tests/plugins/logger + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./tests/plugins/metrics + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./tests/plugins/redis + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./tests/plugins/resetter + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./tests/plugins/rpc + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./tests/plugins/static + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./plugins/kv/boltdb + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./plugins/kv/memory + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./plugins/kv/memcached + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./tests/plugins/kv/boltdb + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./tests/plugins/kv/memory + go test -v -race -cover -tags=debug -coverpkg=./... -covermode=atomic ./tests/plugins/kv/memcached docker-compose -f tests/docker-compose.yaml down lint: ## Run application linters diff --git a/cmd/cli/reset.go b/cmd/cli/reset.go index 504d88ad..a5055a53 100644 --- a/cmd/cli/reset.go +++ b/cmd/cli/reset.go @@ -26,8 +26,8 @@ func init() { }) } -func resetHandler(cmd *cobra.Command, args []string) error { - const op = errors.Op("reset handler") +func resetHandler(_ *cobra.Command, args []string) error { + const op = errors.Op("reset_handler") client, err := RPCClient() if err != nil { return err diff --git a/cmd/cli/serve.go b/cmd/cli/serve.go index 2fe54932..993ec477 100644 --- a/cmd/cli/serve.go +++ b/cmd/cli/serve.go @@ -19,8 +19,8 @@ func init() { }) } -func handler(cmd *cobra.Command, args []string) error { - const op = errors.Op("handle serve command") +func handler(_ *cobra.Command, _ []string) error { + const op = errors.Op("handle_serve_command") /* We need to have path to the config at the RegisterTarget stage But after cobra.Execute, because cobra fills up cli variables on this stage diff --git a/cmd/cli/workers.go b/cmd/cli/workers.go index 47dd2a85..09642a58 100644 --- a/cmd/cli/workers.go +++ b/cmd/cli/workers.go @@ -42,7 +42,7 @@ func init() { } func workersHandler(_ *cobra.Command, args []string) error { - const op = errors.Op("workers cobra handler") + const op = errors.Op("handle_workers_command") // get RPC client client, err := RPCClient() if err != nil { @@ -94,7 +94,7 @@ func workersHandler(_ *cobra.Command, args []string) error { } func showWorkers(plugins []string, client *rpc.Client) error { - const op = errors.Op("show workers") + const op = errors.Op("show_workers") for _, plugin := range plugins { list := &informer.WorkerList{} err := client.Call(InformerWorkers, plugin, &list) @@ -23,8 +23,8 @@ require ( github.com/spf13/cobra v1.1.1 github.com/spf13/viper v1.7.1 github.com/spiral/endure v1.0.0-beta20 - github.com/spiral/errors v1.0.7 - github.com/spiral/goridge/v3 v3.0.0-beta8 + github.com/spiral/errors v1.0.9 + github.com/spiral/goridge/v3 v3.0.0 github.com/stretchr/testify v1.6.1 github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a github.com/vbauerster/mpb/v5 v5.4.0 @@ -34,7 +34,6 @@ github.com/alicebob/miniredis/v2 v2.14.1/go.mod h1:uS970Sw5Gs9/iK3yBg0l9Uj9s25wX github.com/andybalholm/brotli v1.0.0 h1:7UCwP93aiSfvWpapti8g88vVVGp2qqtGyePsSuDafo4= github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -46,10 +45,8 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b h1:L/QXpzIa3pOvUGt1D1lA5KjYhPBAN/3iWdP7xeFS9F0= github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= -github.com/buger/goterm v0.0.0-20181115115552-c206103e1f37/go.mod h1:u9UyCz2eTrSGy6fbupqJ54eY5c4IC8gREQ1053dK12U= github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129 h1:gfAMKE626QEuKG3si0pdTRcr/YEbBoxY+3GOH3gWvl4= github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129/go.mod h1:u9UyCz2eTrSGy6fbupqJ54eY5c4IC8gREQ1053dK12U= -github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= github.com/cenkalti/backoff/v4 v4.1.0 h1:c8LkOFQTzuO0WBM/ae5HdGQuZPfPxp7lqBRwQRm4fSc= github.com/cenkalti/backoff/v4 v4.1.0/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= @@ -60,12 +57,8 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/containerd/containerd v1.4.3 h1:ijQT13JedHSHrQGWFcGEwzcNKrAGIiZ+jSD5QQG07SY= -github.com/containerd/containerd v1.4.3/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= @@ -77,17 +70,6 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= -github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v1.13.1 h1:IkZjBSIc8hBjLpqeAbeE5mca5mNgeatLHBy3GO78BWo= -github.com/docker/docker v20.10.2+incompatible h1:vFgEHPqWBTp4pTjdLwjAA4bSo3gvIGOYwuJTlEjVBCw= -github.com/docker/docker v20.10.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4 h1:qk/FSDDxo05wdJH28W+p5yivv7LuLYLRXPPD8KQCtZs= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= @@ -153,7 +135,6 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= @@ -201,19 +182,16 @@ github.com/klauspost/compress v1.10.7 h1:7rix8v8GpI3ZBb0nSozFRgbtXKv+hOe+qfEpZqy github.com/klauspost/compress v1.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI= @@ -225,7 +203,6 @@ github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/Qd github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -256,18 +233,12 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.10.4 h1:NiTx7EEvBzu9sFOD1zORteLSt3o8gnlvZZwSE9TnY9U= github.com/onsi/gomega v1.10.4/go.mod h1:g/HbgYopi++010VEqkFgJHKC09uJiW9UkXvMUuKHUCQ= -github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= -github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= -github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -300,7 +271,6 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/shirou/gopsutil v2.20.7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/gopsutil v3.20.11+incompatible h1:LJr4ZQK4mPpIV5gOa4jCOKOGb4ty4DZO54I4FGqIpto= github.com/shirou/gopsutil v3.20.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -308,8 +278,6 @@ github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -322,7 +290,6 @@ github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4= github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= @@ -331,7 +298,6 @@ github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk= @@ -341,18 +307,10 @@ github.com/spiral/endure v1.0.0-beta20/go.mod h1:qCU2/4gAItVESzUK0yPExmUTlTcpRLq github.com/spiral/errors v1.0.4/go.mod h1:SwMSZVdZkkJVgXNNafccqOaxWg0XPzVU/dEdUEInE0o= github.com/spiral/errors v1.0.5 h1:TwlR9cZtTgnZrSngcEUpyiMO9yJ45gdQ+XcrCRoCCAM= github.com/spiral/errors v1.0.5/go.mod h1:SwMSZVdZkkJVgXNNafccqOaxWg0XPzVU/dEdUEInE0o= -github.com/spiral/errors v1.0.6 h1:berk5ShEILSw6DplUVv9Ea1wGdk2WlVKQpuvDngll0U= -github.com/spiral/errors v1.0.6/go.mod h1:SwMSZVdZkkJVgXNNafccqOaxWg0XPzVU/dEdUEInE0o= -github.com/spiral/errors v1.0.7 h1:GRN7Sjk4yVavD2W+1fUWBjqoivWQsnbsXbX7xyhZhbU= -github.com/spiral/errors v1.0.7/go.mod h1:SwMSZVdZkkJVgXNNafccqOaxWg0XPzVU/dEdUEInE0o= -github.com/spiral/goridge v1.0.4 h1:qnYtI84H0tcYjcbFdFl/VUFQZ0YUE9p+VuU8In4kC/8= -github.com/spiral/goridge v2.1.4+incompatible h1:L15TKrbPEp/G6JfS3jjuvY6whkhfD292XX+1iy9mO2k= -github.com/spiral/goridge/v2 v2.4.6/go.mod h1:mYjL+Ny7nVfLqjRwIYV2pUSQ61eazvVclHII6FfZfYc= -github.com/spiral/goridge/v3 v3.0.0-beta8 h1:x8uXCdhY49U1LEvmehnTaD2El6J9ZHAefRdh/QIZ6A4= -github.com/spiral/goridge/v3 v3.0.0-beta8/go.mod h1:XFQGc42KNzo/hPIXPki7mEkFTf9v/T7qFk/TYJjMtzE= -github.com/spiral/kv v0.0.0-20200601133055-3397db7fc998 h1:TtGWRjpF7iQy1IA7nuJXVfhnJb9m39pf7YuBXNPcKMc= -github.com/spiral/roadrunner v1.9.1 h1:905qx8bIQN/XBz+ScOqrPeKdqf0lqm9rXwO//b5N4C4= -github.com/spiral/roadrunner v1.9.1/go.mod h1:Q1al1YGjs7ZHVkAA7+gUKM0rwk6XWG07G0UjyjjuK+0= +github.com/spiral/errors v1.0.9 h1:RcVZ7a1RYkaT3HWFGDuQiDB02pG6yqh7715Uwd7urwM= +github.com/spiral/errors v1.0.9/go.mod h1:SwMSZVdZkkJVgXNNafccqOaxWg0XPzVU/dEdUEInE0o= +github.com/spiral/goridge/v3 v3.0.0 h1:FIz6wHaob5KynpOfzVpzj4bmqbEelGPFyuEf4i2+CG8= +github.com/spiral/goridge/v3 v3.0.0/go.mod h1:XFQGc42KNzo/hPIXPki7mEkFTf9v/T7qFk/TYJjMtzE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -363,7 +321,6 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.18.0 h1:IV0DdMlatq9QO1Cr6wGJPVW1sV1Q8HvZXAIcjorylyM= @@ -375,7 +332,6 @@ github.com/vbauerster/mpb/v5 v5.4.0/go.mod h1:fi4wVo7BVQ22QcvFObm+VwliQXlV1eBT8J github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yookoala/gofast v0.4.0 h1:dLBjghcsbbZNOEHN8N1X/gh9S6srmJed4WQfG7DlKwo= github.com/yookoala/gofast v0.4.0/go.mod h1:rfbkoKaQG1bnuTUZcmV3vAlnfpF4FTq8WbQJf2vcpg8= github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb h1:ZkM6LRnq40pR1Ox0hTHlnpkcOTuFIDQpZ1IN8rKKhX0= @@ -440,12 +396,10 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201016165138-7b1cca2348c0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= @@ -553,7 +507,6 @@ google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a h1:Ob5/580gVHBJZgX google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/interfaces/events/pool_events.go b/interfaces/events/pool_events.go index d1464e1a..2cc76eee 100644 --- a/interfaces/events/pool_events.go +++ b/interfaces/events/pool_events.go @@ -1,5 +1,6 @@ package events +// TODO event numbers const ( // EventWorkerConstruct thrown when new worker is spawned. EventWorkerConstruct P = iota + 7800 @@ -19,7 +20,7 @@ const ( // EventMaxMemory caused when worker consumes more memory than allowed. EventMaxMemory - // EventTTL thrown when worker is removed due TTL being reached. Context is rr.WorkerError + // EventTTL thrown when worker is removed due TTL being reached. TTL defines maximum time worker is allowed to live (seconds) EventTTL // EventIdleTTL triggered when worker spends too much time at rest. diff --git a/internal/protocol.go b/internal/protocol.go index a099ce4d..19678067 100755 --- a/internal/protocol.go +++ b/internal/protocol.go @@ -20,7 +20,7 @@ type pidCommand struct { } func SendControl(rl relay.Relay, payload interface{}) error { - const op = errors.Op("send control frame") + const op = errors.Op("send_control") fr := frame.NewFrame() fr.WriteVersion(frame.VERSION_1) fr.WriteFlags(frame.CONTROL) @@ -60,7 +60,7 @@ func SendControl(rl relay.Relay, payload interface{}) error { } func FetchPID(rl relay.Relay) (int64, error) { - const op = errors.Op("fetchPID") + const op = errors.Op("fetch_pid") err := SendControl(rl, pidCommand{Pid: os.Getpid()}) if err != nil { return 0, errors.E(op, err) diff --git a/pkg/pipe/pipe_factory.go b/pkg/pipe/pipe_factory.go index c36c13e2..b656eff8 100755 --- a/pkg/pipe/pipe_factory.go +++ b/pkg/pipe/pipe_factory.go @@ -32,7 +32,7 @@ type SpawnResult struct { // method Wait() must be handled on level above. func (f *Factory) SpawnWorkerWithTimeout(ctx context.Context, cmd *exec.Cmd, listeners ...events.Listener) (worker.BaseProcess, error) { c := make(chan SpawnResult) - const op = errors.Op("spawn worker with context") + const op = errors.Op("factory_spawn_worker_with_timeout") go func() { w, err := workerImpl.InitBaseWorker(cmd, workerImpl.AddListeners(listeners...)) if err != nil { @@ -114,7 +114,7 @@ func (f *Factory) SpawnWorkerWithTimeout(ctx context.Context, cmd *exec.Cmd, lis } func (f *Factory) SpawnWorker(cmd *exec.Cmd, listeners ...events.Listener) (worker.BaseProcess, error) { - const op = errors.Op("spawn worker") + const op = errors.Op("factory_spawn_worker") w, err := workerImpl.InitBaseWorker(cmd, workerImpl.AddListeners(listeners...)) if err != nil { return nil, errors.E(op, err) diff --git a/pkg/pool/static_pool.go b/pkg/pool/static_pool.go index 7cac7b4d..438f936f 100755 --- a/pkg/pool/static_pool.go +++ b/pkg/pool/static_pool.go @@ -54,7 +54,7 @@ type StaticPool struct { // Initialize creates new worker pool and task multiplexer. StaticPool will initiate with one worker. func Initialize(ctx context.Context, cmd Command, factory worker.Factory, cfg Config, options ...Options) (pool.Pool, error) { - const op = errors.Op("static pool initialize") + const op = errors.Op("static_pool_initialize") if factory == nil { return nil, errors.E(op, errors.Str("no factory initialized")) } @@ -174,7 +174,7 @@ func (sp *StaticPool) Exec(p payload.Payload) (payload.Payload, error) { } func (sp *StaticPool) ExecWithContext(ctx context.Context, rqs payload.Payload) (payload.Payload, error) { - const op = errors.Op("exec with context") + const op = errors.Op("static_pool_exec_with_context") ctxGetFree, cancel := context.WithTimeout(ctx, sp.cfg.AllocateTimeout) defer cancel() w, err := sp.getWorker(ctxGetFree, op) @@ -233,6 +233,10 @@ func (sp *StaticPool) Destroy(ctx context.Context) { func defaultErrEncoder(sp *StaticPool) ErrorEncoder { return func(err error, w worker.BaseProcess) (payload.Payload, error) { const op = errors.Op("error encoder") + // just push event if on any stage was timeout error + if errors.Is(errors.ExecTTL, err) { + sp.events.Push(events.PoolEvent{Event: events.EventExecTTL, Payload: errors.E(op, err)}) + } // soft job errors are allowed if errors.Is(errors.SoftJob, err) { if sp.cfg.MaxJobs != 0 && w.State().NumExecs() >= sp.cfg.MaxJobs { diff --git a/pkg/pool/supervisor_pool.go b/pkg/pool/supervisor_pool.go index 07fa7019..19cda759 100755 --- a/pkg/pool/supervisor_pool.go +++ b/pkg/pool/supervisor_pool.go @@ -51,7 +51,7 @@ type ttlExec struct { } func (sp *supervised) ExecWithContext(ctx context.Context, rqs payload.Payload) (payload.Payload, error) { - const op = errors.Op("exec_supervised") + const op = errors.Op("supervised_exec_with_context") if sp.cfg.ExecTTL == 0 { return sp.pool.Exec(rqs) } @@ -89,7 +89,7 @@ func (sp *supervised) ExecWithContext(ctx context.Context, rqs payload.Payload) } func (sp *supervised) Exec(p payload.Payload) (payload.Payload, error) { - const op = errors.Op("supervised exec") + const op = errors.Op("supervised_exec") rsp, err := sp.pool.Exec(p) if err != nil { return payload.Payload{}, errors.E(op, err) @@ -139,7 +139,7 @@ func (sp *supervised) Stop() { func (sp *supervised) control() { now := time.Now() - const op = errors.Op("supervised pool control tick") + const op = errors.Op("supervised_pool_control_tick") // THIS IS A COPY OF WORKERS workers := sp.pool.Workers() diff --git a/pkg/socket/socket_factory.go b/pkg/socket/socket_factory.go index ff882389..8f99ff73 100755 --- a/pkg/socket/socket_factory.go +++ b/pkg/socket/socket_factory.go @@ -86,7 +86,7 @@ type socketSpawn struct { // SpawnWorker creates Process and connects it to appropriate relay or returns error func (f *Factory) SpawnWorkerWithTimeout(ctx context.Context, cmd *exec.Cmd, listeners ...events.Listener) (worker.BaseProcess, error) { - const op = errors.Op("spawn_worker_with_context") + const op = errors.Op("factory_spawn_worker_with_timeout") c := make(chan socketSpawn) go func() { ctx, cancel := context.WithTimeout(ctx, f.tout) @@ -146,7 +146,7 @@ func (f *Factory) SpawnWorkerWithTimeout(ctx context.Context, cmd *exec.Cmd, lis } func (f *Factory) SpawnWorker(cmd *exec.Cmd, listeners ...events.Listener) (worker.BaseProcess, error) { - const op = errors.Op("spawn_worker") + const op = errors.Op("factory_spawn_worker") w, err := workerImpl.InitBaseWorker(cmd, workerImpl.AddListeners(listeners...)) if err != nil { return nil, err @@ -201,7 +201,7 @@ func (f *Factory) findRelayWithContext(ctx context.Context, w worker.BaseProcess } func (f *Factory) findRelay(w worker.BaseProcess) (*socket.Relay, error) { - const op = errors.Op("find_relay") + const op = errors.Op("factory_find_relay") // poll every 1ms for the relay pollDone := time.NewTimer(f.tout) for { diff --git a/pkg/worker/sync_worker.go b/pkg/worker/sync_worker.go index 6a945cf4..8314c039 100755 --- a/pkg/worker/sync_worker.go +++ b/pkg/worker/sync_worker.go @@ -27,7 +27,7 @@ func From(w worker.BaseProcess) (worker.SyncWorker, error) { // Exec payload without TTL timeout. func (tw *syncWorker) Exec(p payload.Payload) (payload.Payload, error) { - const op = errors.Op("sync worker Exec") + const op = errors.Op("sync_worker_exec") if len(p.Body) == 0 && len(p.Context) == 0 { return payload.Payload{}, errors.E(op, errors.Str("payload can not be empty")) } @@ -63,7 +63,7 @@ type wexec struct { // Exec payload without TTL timeout. func (tw *syncWorker) ExecWithTimeout(ctx context.Context, p payload.Payload) (payload.Payload, error) { - const op = errors.Op("ExecWithTimeout") + const op = errors.Op("sync_worker_exec_worker_with_timeout") c := make(chan wexec, 1) go func() { @@ -111,12 +111,15 @@ func (tw *syncWorker) ExecWithTimeout(ctx context.Context, p payload.Payload) (p }() select { + // exec TTL reached case <-ctx.Done(): err := multierr.Combine(tw.Kill()) if err != nil { + // append timeout error + err = multierr.Append(err, errors.E(op, errors.ExecTTL)) return payload.Payload{}, multierr.Append(err, ctx.Err()) } - return payload.Payload{}, ctx.Err() + return payload.Payload{}, errors.E(op, errors.ExecTTL, ctx.Err()) case res := <-c: if res.err != nil { return payload.Payload{}, res.err @@ -126,7 +129,7 @@ func (tw *syncWorker) ExecWithTimeout(ctx context.Context, p payload.Payload) (p } func (tw *syncWorker) execPayload(p payload.Payload) (payload.Payload, error) { - const op = errors.Op("exec pl") + const op = errors.Op("sync_worker_exec_payload") fr := frame.NewFrame() fr.WriteVersion(frame.VERSION_1) diff --git a/pkg/worker/worker.go b/pkg/worker/worker.go index 493882a8..aef7f2b0 100755 --- a/pkg/worker/worker.go +++ b/pkg/worker/worker.go @@ -188,7 +188,7 @@ func (w *Process) Start() error { // will be wrapped as WorkerError. Method will return error code if php process fails // to find or Start the script. func (w *Process) Wait() error { - const op = errors.Op("worker process wait") + const op = errors.Op("process_wait") err := multierr.Combine(w.cmd.Wait()) if w.State().Value() == internal.StateDestroyed { diff --git a/pkg/worker_watcher/worker_watcher.go b/pkg/worker_watcher/worker_watcher.go index bf1f2435..b0d39165 100755 --- a/pkg/worker_watcher/worker_watcher.go +++ b/pkg/worker_watcher/worker_watcher.go @@ -40,7 +40,7 @@ func (ww *workerWatcher) AddToWatch(workers []worker.BaseProcess) error { } func (ww *workerWatcher) GetFreeWorker(ctx context.Context) (worker.BaseProcess, error) { - const op = errors.Op("GetFreeWorker") + const op = errors.Op("worker_watcher_get_free_worker") // thread safe operation w, stop := ww.stack.Pop() if stop { @@ -81,7 +81,7 @@ func (ww *workerWatcher) GetFreeWorker(ctx context.Context) (worker.BaseProcess, func (ww *workerWatcher) AllocateNew() error { ww.stack.mutex.Lock() - const op = errors.Op("allocate new worker") + const op = errors.Op("worker_watcher_allocate_new") sw, err := ww.allocator() if err != nil { return errors.E(op, errors.WorkerAllocate, err) @@ -98,7 +98,7 @@ func (ww *workerWatcher) RemoveWorker(wb worker.BaseProcess) error { ww.mutex.Lock() defer ww.mutex.Unlock() - const op = errors.Op("remove worker") + const op = errors.Op("worker_watcher_remove_worker") pid := wb.Pid() if ww.stack.FindAndRemoveByPid(pid) { @@ -132,7 +132,7 @@ func (ww *workerWatcher) WorkersList() []worker.BaseProcess { } func (ww *workerWatcher) wait(w worker.BaseProcess) { - const op = errors.Op("process wait") + const op = errors.Op("worker_watcher_wait") err := w.Wait() if err != nil { ww.events.Push(events.WorkerEvent{ 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) diff --git a/tests/plugins/config/plugin1.go b/tests/plugins/config/plugin1.go index c77e7aa7..1de9a02e 100755 --- a/tests/plugins/config/plugin1.go +++ b/tests/plugins/config/plugin1.go @@ -62,7 +62,7 @@ func (f *Foo) Init(p config.Configurer) error { } func (f *Foo) Serve() chan error { - const op = errors.Op("foo serve") + const op = errors.Op("foo_plugin_serve") errCh := make(chan error, 1) r := &ReloadConfig{} diff --git a/tests/plugins/gzip/plugin_test.go b/tests/plugins/gzip/plugin_test.go index b09d430e..d525dcc6 100644 --- a/tests/plugins/gzip/plugin_test.go +++ b/tests/plugins/gzip/plugin_test.go @@ -116,8 +116,9 @@ func TestMiddlewareNotExist(t *testing.T) { mockLogger := mocks.NewMockLogger(controller) mockLogger.EXPECT().Warn("requested middleware does not exist", "requested", "foo").AnyTimes() - mockLogger.EXPECT().Info("worker constructed", "pid", gomock.Any()).AnyTimes() - mockLogger.EXPECT().Info(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror + mockLogger.EXPECT().Debug("worker constructed", "pid", gomock.Any()).AnyTimes() + mockLogger.EXPECT().Debug("worker destructed", "pid", gomock.Any()).AnyTimes() + mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror err = cont.RegisterAll( cfg, diff --git a/tests/plugins/http/http_plugin_test.go b/tests/plugins/http/http_plugin_test.go index 51bf7d0b..23628c72 100644 --- a/tests/plugins/http/http_plugin_test.go +++ b/tests/plugins/http/http_plugin_test.go @@ -1025,12 +1025,12 @@ logs: controller := gomock.NewController(t) mockLogger := mocks.NewMockLogger(controller) - mockLogger.EXPECT().Info("worker destructed", "pid", gomock.Any()).MinTimes(1) - mockLogger.EXPECT().Info("worker constructed", "pid", gomock.Any()).MinTimes(1) + mockLogger.EXPECT().Debug("worker destructed", "pid", gomock.Any()).MinTimes(1) + mockLogger.EXPECT().Debug("worker constructed", "pid", gomock.Any()).MinTimes(1) mockLogger.EXPECT().Debug("", "remote", gomock.Any(), "ts", gomock.Any(), "resp.status", gomock.Any(), "method", gomock.Any(), "uri", gomock.Any()).MinTimes(1) - mockLogger.EXPECT().Info("WORLD", "pid", gomock.Any()).MinTimes(1) + mockLogger.EXPECT().Debug("WORLD", "pid", gomock.Any()).MinTimes(1) mockLogger.EXPECT().Debug("worker event received", "event", events.EventWorkerLog, "worker state", gomock.Any()).MinTimes(1) - mockLogger.EXPECT().Info(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror + mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror err = cont.RegisterAll( cfg, diff --git a/tests/plugins/reload/reload_plugin_test.go b/tests/plugins/reload/reload_plugin_test.go index c83d4787..81ac3c44 100644 --- a/tests/plugins/reload/reload_plugin_test.go +++ b/tests/plugins/reload/reload_plugin_test.go @@ -47,7 +47,8 @@ func TestReloadInit(t *testing.T) { controller := gomock.NewController(t) mockLogger := mocks.NewMockLogger(controller) - mockLogger.EXPECT().Info("worker constructed", "pid", gomock.Any()).AnyTimes() + mockLogger.EXPECT().Debug("worker destructed", "pid", gomock.Any()).AnyTimes() + mockLogger.EXPECT().Debug("worker constructed", "pid", gomock.Any()).AnyTimes() mockLogger.EXPECT().Debug("http handler response received", "elapsed", gomock.Any(), "remote address", "127.0.0.1").Times(1) mockLogger.EXPECT().Debug("file was created", "path", gomock.Any(), "name", "file.txt", "size", gomock.Any()).Times(2) mockLogger.EXPECT().Debug("file was added to watcher", "path", gomock.Any(), "name", "file.txt", "size", gomock.Any()).Times(2) @@ -55,7 +56,7 @@ func TestReloadInit(t *testing.T) { mockLogger.EXPECT().Info("HTTP workers Pool successfully restarted").Times(1) mockLogger.EXPECT().Info("HTTP listeners successfully re-added").Times(1) mockLogger.EXPECT().Info("HTTP plugin successfully restarted").Times(1) - mockLogger.EXPECT().Info(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror + mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror err = cont.RegisterAll( cfg, @@ -140,7 +141,8 @@ func TestReloadHugeNumberOfFiles(t *testing.T) { controller := gomock.NewController(t) mockLogger := mocks.NewMockLogger(controller) - mockLogger.EXPECT().Info("worker constructed", "pid", gomock.Any()).AnyTimes() + mockLogger.EXPECT().Debug("worker destructed", "pid", gomock.Any()).MinTimes(1) + mockLogger.EXPECT().Debug("worker constructed", "pid", gomock.Any()).AnyTimes() mockLogger.EXPECT().Debug("file added to the list of removed files", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).AnyTimes() mockLogger.EXPECT().Debug("http handler response received", "elapsed", gomock.Any(), "remote address", "127.0.0.1").Times(1) mockLogger.EXPECT().Debug("file was created", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(1) @@ -150,7 +152,7 @@ func TestReloadHugeNumberOfFiles(t *testing.T) { mockLogger.EXPECT().Info("HTTP workers Pool successfully restarted").MinTimes(1) mockLogger.EXPECT().Info("HTTP listeners successfully re-added").MinTimes(1) mockLogger.EXPECT().Info("HTTP plugin successfully restarted").MinTimes(1) - mockLogger.EXPECT().Info(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror + mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror err = cont.RegisterAll( cfg, @@ -249,7 +251,8 @@ func TestReloadFilterFileExt(t *testing.T) { controller := gomock.NewController(t) mockLogger := mocks.NewMockLogger(controller) - mockLogger.EXPECT().Info("worker constructed", "pid", gomock.Any()).AnyTimes() + mockLogger.EXPECT().Debug("worker destructed", "pid", gomock.Any()).MinTimes(1) + mockLogger.EXPECT().Debug("worker constructed", "pid", gomock.Any()).AnyTimes() mockLogger.EXPECT().Debug("http handler response received", "elapsed", gomock.Any(), "remote address", "127.0.0.1").Times(1) mockLogger.EXPECT().Debug("file was created", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(100) mockLogger.EXPECT().Debug("file was added to watcher", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(1) @@ -258,7 +261,7 @@ func TestReloadFilterFileExt(t *testing.T) { mockLogger.EXPECT().Info("HTTP workers Pool successfully restarted").Times(1) mockLogger.EXPECT().Info("HTTP listeners successfully re-added").Times(1) mockLogger.EXPECT().Info("HTTP plugin successfully restarted").Times(1) - mockLogger.EXPECT().Info(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror + mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror err = cont.RegisterAll( cfg, @@ -376,7 +379,8 @@ func TestReloadCopy500(t *testing.T) { controller := gomock.NewController(t) mockLogger := mocks.NewMockLogger(controller) // - mockLogger.EXPECT().Info("worker constructed", "pid", gomock.Any()).AnyTimes() + mockLogger.EXPECT().Debug("worker destructed", "pid", gomock.Any()).MinTimes(1) + mockLogger.EXPECT().Debug("worker constructed", "pid", gomock.Any()).AnyTimes() mockLogger.EXPECT().Debug("http handler response received", "elapsed", gomock.Any(), "remote address", "127.0.0.1").Times(1) mockLogger.EXPECT().Debug("file was created", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(50) mockLogger.EXPECT().Debug("file was added to watcher", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(50) @@ -387,7 +391,7 @@ func TestReloadCopy500(t *testing.T) { mockLogger.EXPECT().Info("HTTP workers Pool successfully restarted").MinTimes(1) mockLogger.EXPECT().Info("HTTP listeners successfully re-added").MinTimes(1) mockLogger.EXPECT().Info("HTTP plugin successfully restarted").MinTimes(1) - mockLogger.EXPECT().Info(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror + mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror err = cont.RegisterAll( cfg, @@ -660,10 +664,11 @@ func TestReloadNoRecursion(t *testing.T) { mockLogger := mocks.NewMockLogger(controller) // http server should not be restarted. all event from wrong file extensions should be skipped - mockLogger.EXPECT().Info("worker constructed", "pid", gomock.Any()).MinTimes(1) + mockLogger.EXPECT().Debug("worker destructed", "pid", gomock.Any()).MinTimes(1) + mockLogger.EXPECT().Debug("worker constructed", "pid", gomock.Any()).MinTimes(1) mockLogger.EXPECT().Debug("http handler response received", "elapsed", gomock.Any(), "remote address", "127.0.0.1").Times(1) mockLogger.EXPECT().Debug("file added to the list of removed files", "path", gomock.Any(), "name", gomock.Any(), "size", gomock.Any()).MinTimes(1) - mockLogger.EXPECT().Info(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror + mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror err = cont.RegisterAll( cfg, diff --git a/tests/plugins/static/static_plugin_test.go b/tests/plugins/static/static_plugin_test.go index a411193d..49721e44 100644 --- a/tests/plugins/static/static_plugin_test.go +++ b/tests/plugins/static/static_plugin_test.go @@ -303,10 +303,11 @@ func TestStaticFilesForbid(t *testing.T) { controller := gomock.NewController(t) mockLogger := mocks.NewMockLogger(controller) - mockLogger.EXPECT().Info("worker constructed", "pid", gomock.Any()).AnyTimes() + mockLogger.EXPECT().Debug("worker destructed", "pid", gomock.Any()).AnyTimes() + mockLogger.EXPECT().Debug("worker constructed", "pid", gomock.Any()).AnyTimes() mockLogger.EXPECT().Debug("", "remote", gomock.Any(), "ts", gomock.Any(), "resp.status", gomock.Any(), "method", gomock.Any(), "uri", gomock.Any()).AnyTimes() mockLogger.EXPECT().Error("file open error", "error", gomock.Any()).AnyTimes() - mockLogger.EXPECT().Info(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror + mockLogger.EXPECT().Error(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() // placeholder for the workerlogerror err = cont.RegisterAll( cfg, diff --git a/tools/process.go b/tools/process.go index d92755d1..50fe1616 100644 --- a/tools/process.go +++ b/tools/process.go @@ -27,7 +27,7 @@ type ProcessState struct { // WorkerProcessState creates new worker state definition. func WorkerProcessState(w worker.BaseProcess) (ProcessState, error) { - const op = errors.Op("worker_process state") + const op = errors.Op("worker_process_state") p, _ := process.NewProcess(int32(w.Pid())) i, err := p.MemoryInfo() if err != nil { diff --git a/utils/isolate.go b/utils/isolate.go index b797a999..b05f4b3a 100755 --- a/utils/isolate.go +++ b/utils/isolate.go @@ -20,7 +20,7 @@ func IsolateProcess(cmd *exec.Cmd) { // ExecuteFromUser may work only if run RR under root user func ExecuteFromUser(cmd *exec.Cmd, u string) error { - const op = errors.Op("execute from user") + const op = errors.Op("execute_from_user") usr, err := user.Lookup(u) if err != nil { return errors.E(op, err) |