Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move non-relevant logs to debug log level #87

Merged
merged 2 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions beanstalkjobs/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"go.uber.org/zap"
)

var errBeanstalkTimeout = stderr.New("beanstalk timeout")

type ConnPool struct {
sync.RWMutex

Expand Down Expand Up @@ -96,7 +98,7 @@ func (cp *ConnPool) Reserve(reserveTimeout time.Duration) (uint64, []byte, error
// errN contains both, err and internal checkAndRedial error
errN := cp.checkAndRedial(err)
if errN != nil {
return 0, nil, errors.Errorf("err: %s\nerr redial: %s", err, errN)
return 0, nil, stderr.Join(err, errN)
}

// retry Reserve only when we redialed
Expand All @@ -118,13 +120,13 @@ func (cp *ConnPool) Delete(_ context.Context, id uint64) error {
return errors.Errorf("err: %s\nerr redial: %s", err, errN)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of errors.Errorf in the Delete method seems inconsistent with the PR's objective to reduce verbosity. Consider using stderr.Join or a similar approach to align with the changes made in the Reserve method.

}

// retry Delete only when we redialed
// retry, Delete only when we redialed
return cp.connTS.Load().Delete(id)
}
return nil
}

func (cp *ConnPool) Stats(context.Context) (map[string]string, error) {
func (cp *ConnPool) Stats(_ context.Context) (map[string]string, error) {
cp.RLock()
defer cp.RUnlock()

Expand Down Expand Up @@ -206,7 +208,8 @@ func (cp *ConnPool) checkAndRedial(err error) error {
var bErr *net.OpError

if stderr.As(err, &et) {
if stderr.As(et.Err, &bErr) {
switch {
case stderr.As(et.Err, &bErr):
cp.log.Debug("beanstalk connection error, redialing", zap.Error(et))
cp.RUnlock()
errR := cp.redial()
Expand All @@ -220,9 +223,7 @@ func (cp *ConnPool) checkAndRedial(err error) error {
cp.log.Debug("beanstalk redial was successful")
// if redial was successful -> continue listening
return nil
}

if et.Err.Error() == EOF {
case et.Err.Error() == EOF:
cp.log.Debug("beanstalk connection error, redialing", zap.Error(et.Err))
// if error is related to the broken connection - redial
cp.RUnlock()
Expand All @@ -237,6 +238,9 @@ func (cp *ConnPool) checkAndRedial(err error) error {
cp.log.Debug("beanstalk redial was successful")
// if redial was successful -> continue listening
return nil
case et.Op == "reserve-with-timeout" && (et.Err.Error() == "deadline soon" || et.Err.Error() == "timeout"):
cp.log.Debug("connection deadline reached, continue listening", zap.Error(et))
return errBeanstalkTimeout
}
}

Expand Down
2 changes: 1 addition & 1 deletion beanstalkjobs/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const (
type Item struct {
// Job contains pluginName of job broker (usually PHP class).
Job string `json:"job"`
// Ident is unique identifier of the job, should be provided from outside
// Ident is a unique identifier of the job, should be provided from outside
Ident string `json:"id"`
// Payload is string data (usually JSON) passed to Job broker.
Payload []byte `json:"payload"`
Expand Down
15 changes: 5 additions & 10 deletions beanstalkjobs/listen.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
stderr "errors"

"github.com/beanstalkd/go-beanstalk"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/propagation"
"go.uber.org/zap"
Expand All @@ -21,17 +20,13 @@ func (d *Driver) listen() {
default:
id, body, err := d.pool.Reserve(d.reserveTimeout)
if err != nil {
// error isn't wrapped
var errB beanstalk.ConnError
if stderr.As(err, &errB) {
if stderr.Is(errB.Err, beanstalk.ErrTimeout) {
d.log.Info("beanstalk reserve timeout", zap.Error(errB))
continue
}
// this is not an error, but just a wait timeout for the new job
if stderr.Is(err, errBeanstalkTimeout) {
continue
}

// in case of other error - continue
d.log.Warn("beanstalk reserve", zap.Error(err))
// in case of another error log and continue
d.log.Error("beanstalk listen", zap.Error(err))
continue
}

Expand Down
9 changes: 1 addition & 8 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,6 @@ github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
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/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8=
Expand Down Expand Up @@ -370,6 +368,7 @@ github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJ
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
github.com/mholt/acmez v1.2.0 h1:1hhLxSgY5FvH5HCnGUuwbKY2VQVo8IU7rxXKSnZ7F30=
github.com/mholt/acmez v1.2.0/go.mod h1:VT9YwH1xgNX1kmYY89gY8xPJC84BFAisjo8Egigt4kE=
github.com/miekg/dns v1.1.56 h1:5imZaSeoRNvpM9SzWNhEcP9QliKiz20/dA2QabIGVnE=
Expand Down Expand Up @@ -417,8 +416,6 @@ github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFu
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/sftp v1.13.1 h1:I2qBYMChEhIjOgazfJmV3/mZM256btk6wkCDRmW7JYs=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM=
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU=
github.com/rabbitmq/amqp091-go v1.8.1 h1:RejT1SBUim5doqcL6s7iN6SBmsQqyTgXb1xMlH0h1hA=
Expand Down Expand Up @@ -496,16 +493,12 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245 h1:K1Xf3bKttbF+koVGaX5xngRIZ5bVjbmPnaxE/dR08uY=
github.com/sagikazarmark/crypt v0.10.0 h1:96E1qrToLBU6fGzo+PRRz7KGOc9FkYFiPnR3/zf8Smg=
github.com/sagikazarmark/crypt v0.10.0/go.mod h1:gwTNHQVoOS3xp9Xvz5LLR+1AauC5M6880z5NWzdhOyQ=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys=
github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=
github.com/segmentio/encoding v0.3.6 h1:E6lVLyDPseWEulBmCmAKPanDd3jiyGDo5gMcugCRwZQ=
github.com/segmentio/encoding v0.3.6/go.mod h1:n0JeuIqEQrQoPDGsjo8UNd1iA0U8d8+oHAA4E3G3OxM=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ=
github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI=
github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI=
github.com/temporalio/roadrunner-temporal/v4 v4.5.0-beta.1 h1:ydGSV1fPM05OWYIRvNQJvoVPzuaKeLk6SFP0bgWO5Tg=
github.com/temporalio/roadrunner-temporal/v4 v4.5.0-beta.1/go.mod h1:Qg9LuVZOEn5WYdZupCTK5SVLZsmdMVQuJkyH3tl2t4g=
github.com/twmb/franz-go v1.15.0 h1:bw5n1COKJzWpkCXG/kMtHrurcS9HSWV6e3If5CUdc+M=
Expand Down
2 changes: 1 addition & 1 deletion tests/configs/.rr-beanstalk-init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ beanstalk:
timeout: 10s

logs:
level: info
level: debug
encoding: console
mode: development

Expand Down
42 changes: 21 additions & 21 deletions tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ require (
github.com/goccy/go-json v0.10.2
github.com/google/uuid v1.4.0
github.com/roadrunner-server/api/v4 v4.9.0
github.com/roadrunner-server/beanstalk/v4 v4.5.11
github.com/roadrunner-server/config/v4 v4.6.2
github.com/roadrunner-server/beanstalk/v4 v4.5.12
github.com/roadrunner-server/config/v4 v4.6.3
github.com/roadrunner-server/endure/v2 v2.4.3
github.com/roadrunner-server/goridge/v3 v3.8.1
github.com/roadrunner-server/informer/v4 v4.3.9
github.com/roadrunner-server/jobs/v4 v4.7.8
github.com/roadrunner-server/logger/v4 v4.2.9
github.com/roadrunner-server/otel/v4 v4.3.7
github.com/roadrunner-server/resetter/v4 v4.0.16
github.com/roadrunner-server/rpc/v4 v4.2.10
github.com/roadrunner-server/server/v4 v4.5.2
github.com/roadrunner-server/informer/v4 v4.3.10
github.com/roadrunner-server/jobs/v4 v4.7.9
github.com/roadrunner-server/logger/v4 v4.2.10
github.com/roadrunner-server/otel/v4 v4.3.8
github.com/roadrunner-server/resetter/v4 v4.0.17
github.com/roadrunner-server/rpc/v4 v4.2.11
github.com/roadrunner-server/server/v4 v4.5.3
github.com/stretchr/testify v1.8.4
go.uber.org/zap v1.26.0
)
Expand Down Expand Up @@ -66,18 +66,18 @@ require (
github.com/roadrunner-server/sdk/v4 v4.5.3 // indirect
github.com/roadrunner-server/tcplisten v1.4.0 // indirect
github.com/robfig/cron v1.2.0 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.17.0 // indirect
github.com/spf13/viper v1.18.1 // indirect
github.com/stretchr/objx v0.5.1 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/tklauser/go-sysconf v0.3.13 // indirect
github.com/tklauser/numcpus v0.7.0 // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
Expand All @@ -98,15 +98,15 @@ require (
go.temporal.io/sdk/contrib/opentelemetry v0.3.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.4.0 // indirect
google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/genproto v0.0.0-20231127180814-3a041ad873d4 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231127180814-3a041ad873d4 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
Loading
Loading