From 9f3d167d5d85d345c7d0ee666be075a545a553f4 Mon Sep 17 00:00:00 2001 From: Hank Donnay Date: Wed, 3 Mar 2021 13:45:41 -0600 Subject: [PATCH] logging: move to zlog throughout This also does some log print cleanups, like fixing "component" names and using `Stringer(..., val)` in place of `String(..., val.String())` where appropriate. Signed-off-by: Hank Donnay --- cmd/clair/main.go | 33 ++++---- go.sum | 56 -------------- httptransport/affectedmanifesthandler.go | 6 -- httptransport/notificationshandler.go | 22 +++--- httptransport/server.go | 20 ++--- httptransport/updateoperationhandler.go | 15 ++-- initialize/logging.go | 44 +++++------ initialize/services.go | 12 ++- introspection/server.go | 31 ++++---- middleware/auth/httpauth_psk.go | 23 +++--- notifier/amqp/failover.go | 24 +++--- notifier/delivery.go | 86 +++++++++++++-------- notifier/keymanager/manager.go | 63 +++++++++------ notifier/poller.go | 49 +++++++----- notifier/postgres/deletenotifications.go | 18 +++-- notifier/postgres/keystore.go | 17 ++-- notifier/postgres/notifications.go | 6 +- notifier/processor.go | 98 ++++++++++++++---------- notifier/service/service.go | 74 ++++++++++-------- notifier/stomp/failover.go | 15 ++-- notifier/webhook/deliverer.go | 20 ++--- 21 files changed, 386 insertions(+), 346 deletions(-) diff --git a/cmd/clair/main.go b/cmd/clair/main.go index 5a0a94104a..54f117edfa 100644 --- a/cmd/clair/main.go +++ b/cmd/clair/main.go @@ -11,7 +11,9 @@ import ( "time" _ "github.com/quay/claircore/updater/defaults" - "github.com/rs/zerolog" + "github.com/quay/zlog" + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/label" "golang.org/x/sync/errgroup" yaml "gopkg.in/yaml.v3" @@ -59,35 +61,36 @@ func main() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - ctx, err = initialize.Logging(ctx, &conf) - if err != nil { + if err := initialize.Logging(ctx, &conf); err != nil { golog.Fatalf("failed to set up logging: %v", err) } - logger := zerolog.Ctx(ctx).With().Str("component", "main").Logger() - logger.Info().Str("version", Version).Msg("starting") + ctx = baggage.ContextWithValues(ctx, label.String("component", "main")) + zlog.Info(ctx). + Str("version", Version). + Msg("starting") // Some machinery for starting and stopping server goroutines down := &Shutdown{} srvs, srvctx := errgroup.WithContext(ctx) srvs.Go(func() (_ error) { - logger.Info().Msg("launching introspection server") + zlog.Info(ctx).Msg("launching introspection server") i, err := introspection.New(ctx, conf, nil) if err != nil { - logger.Warn(). + zlog.Warn(ctx). Err(err).Msg("introspection server configuration failed. continuing anyway") return } down.Add(i.Server) if err := i.ListenAndServe(); err != http.ErrServerClosed { - logger.Warn(). + zlog.Warn(ctx). Err(err).Msg("introspection server failed to launch. continuing anyway") } return }) srvs.Go(func() error { - logger.Info().Msg("launching http transport") + zlog.Info(ctx).Msg("launching http transport") srvs, err := initialize.Services(ctx, &conf) if err != nil { return fmt.Errorf("service initialization failed: %w", err) @@ -105,21 +108,21 @@ func main() { c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt) - logger.Info().Msg("registered signal handler") - logger.Info().Str("version", Version).Msg("ready") + zlog.Info(ctx).Msg("registered signal handler") + zlog.Info(ctx).Str("version", Version).Msg("ready") select { case sig := <-c: - logger.Info(). - Str("signal", sig.String()). + zlog.Info(ctx). + Stringer("signal", sig). Msg("gracefully shutting down") tctx, done := context.WithTimeout(ctx, 10*time.Second) err := down.Shutdown(tctx) done() if err != nil { - logger.Error().Err(err).Msg("error shutting down server") + zlog.Error(ctx).Err(err).Msg("error shutting down server") } case <-srvctx.Done(): - logger.Error().Err(srvctx.Err()).Msg("initialization failed") + zlog.Error(ctx).Err(srvctx.Err()).Msg("initialization failed") os.Exit(1) } } diff --git a/go.sum b/go.sum index b2d9d03e88..5f5762f8ed 100644 --- a/go.sum +++ b/go.sum @@ -36,13 +36,11 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7 github.com/Azure/azure-sdk-for-go v19.1.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-autorest v10.15.5+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= github.com/Microsoft/go-winio v0.4.15-0.20200113171025-3fe6c5262873/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= @@ -89,7 +87,6 @@ github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZw github.com/benbjohnson/clock v1.0.3 h1:vkLuvpK4fmtSCuo60+yC63p7y0BmQ8gm5ZXGuBCJyXg= github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= @@ -108,7 +105,6 @@ 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/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= -github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= @@ -137,7 +133,6 @@ github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -164,7 +159,6 @@ github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsv github.com/docker/docker-credential-helpers v0.6.3 h1:zI2p9+1NQYdnG6sMU26EX4aVGlqbInSQxQXLvzJ4RPQ= github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y= 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/doug-martin/goqu/v8 v8.6.0 h1:KWuDGL135poBgY+SceArvOtIIEpieNKgIZCvgerI228= github.com/doug-martin/goqu/v8 v8.6.0/go.mod h1:wiiYWkiguNXK5d4kGIkYmOxBScEL37d9Cfv9tXhPsTk= @@ -183,13 +177,11 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsouza/go-dockerclient v1.6.5/go.mod h1:GOdftxWLWIbIWKbIMDroKFJzPdg6Iw7r+jX1DDZdVsA= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -221,7 +213,6 @@ github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stomp/stomp v2.0.6+incompatible h1:4arQsMXdczrQtVOkhY7Rzt0AIDPs3yheg7vvmWEobSA= github.com/go-stomp/stomp v2.0.6+incompatible/go.mod h1:VqCtqNZv1226A1/79yh+rMiFUcfY3R109np+7ke4n0c= -github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/gocolly/colly/v2 v2.0.1/go.mod h1:ePrRZlJcLTU2C/f8pJzXfkdBtBDHL5hOaKLcBoiJcq8= github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= @@ -232,9 +223,7 @@ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -242,7 +231,6 @@ github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4er github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= @@ -252,7 +240,6 @@ github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71 github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= @@ -263,7 +250,6 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= @@ -273,9 +259,7 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -286,7 +270,6 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-containerregistry v0.0.0-20191206185556-eb7c14b719c6 h1:G+394moNSOPMULZX40YUbVJ4rVuIkmLNvJG5qEX3tTM= github.com/google/go-containerregistry v0.0.0-20191206185556-eb7c14b719c6/go.mod h1:rodaC7jYStJ2mjR8Y+5a/jCzcRPFRH74KmqSnJC88co= github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -302,7 +285,6 @@ github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLe github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -341,24 +323,20 @@ github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09 github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hooklift/assert v0.0.0-20170704181755-9d1defd6d214/go.mod h1:kj6hFWqfwSjFjLnYW5PK1DoxZ4O0uapwHRmd9jhln4E= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= -github.com/jackc/chunkreader/v2 v2.0.0 h1:DUwgMQuuPnS0rhMXenUtZpqZqrR/30NWY+qQvTpSvEs= github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= @@ -368,7 +346,6 @@ github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsU github.com/jackc/pgconn v1.4.0/go.mod h1:Y2O3ZDF0q4mMacyWV3AstPJpeHXWGEetiFttmq5lahk= github.com/jackc/pgconn v1.5.0/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= github.com/jackc/pgconn v1.5.1-0.20200601181101-fa742c524853/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI= -github.com/jackc/pgconn v1.6.1 h1:lwofaXKPbIx6qEaK8mNm7uZuOwxHw+PnAFGDsDFpkRI= github.com/jackc/pgconn v1.6.1/go.mod h1:g8mKMqmSUO6AzAvha7vy07g1rbGOlc7iF0nU0ei83hc= github.com/jackc/pgconn v1.6.2 h1:ifRs/oHByR6NfEXfusvjoTqX/KcSvDYNFASoK/wXKfs= github.com/jackc/pgconn v1.6.2/go.mod h1:w2pne1C2tZgP+TvjqLpOigGzNqjBgQW9dUw/4Chex78= @@ -387,7 +364,6 @@ github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1: github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.0.2 h1:q1Hsy66zh4vuNsajBUF2PNqfAMMfxU5mk594lPE9vjY= github.com/jackc/pgproto3/v2 v2.0.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8 h1:Q3tB+ExeflWUW7AFcAhXqk40s9mnNYLk1nOkKNZ5GnU= github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= @@ -397,7 +373,6 @@ github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrU github.com/jackc/pgtype v1.2.0/go.mod h1:5m2OfMh1wTK7x+Fk952IDmI4nw3nPrvtQdM0ZT4WpC0= github.com/jackc/pgtype v1.3.1-0.20200510190516-8cd94a14c75a/go.mod h1:vaogEUkALtxZMCH411K+tKzNpwzCKU+AnPzBKZ+I+Po= github.com/jackc/pgtype v1.3.1-0.20200606141011-f6355165a91c/go.mod h1:cvk9Bgu/VzJ9/lxTO5R5sf80p0DiucVtN7ZxvaC4GmQ= -github.com/jackc/pgtype v1.4.0 h1:pHQfb4jh9iKqHyxPthq1fr+0HwSNIl3btYPbw2m2lbM= github.com/jackc/pgtype v1.4.0/go.mod h1:JCULISAZBFGrHaOXIIFiyfzW5VY0GRitRr8NeJsrdig= github.com/jackc/pgtype v1.4.1 h1:8PRKqCS9Nt2FQbNegoEAIlY6r/DTP2aaXyh5bAEn89g= github.com/jackc/pgtype v1.4.1/go.mod h1:JCULISAZBFGrHaOXIIFiyfzW5VY0GRitRr8NeJsrdig= @@ -407,7 +382,6 @@ github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQ github.com/jackc/pgx/v4 v4.5.0/go.mod h1:EpAKPLdnTorwmPUUsqrPxy5fphV18j9q3wrfRXgo+kA= github.com/jackc/pgx/v4 v4.6.1-0.20200510190926-94ba730bb1e9/go.mod h1:t3/cdRQl6fOLDxqtlyhe9UWgfIi9R8+8v8GKV5TRA/o= github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904/go.mod h1:ZDaNWkt9sW1JMiNn0kdYBaLelIhw7Pg4qd+Vk6tw7Hg= -github.com/jackc/pgx/v4 v4.7.1 h1:aqUSOcStk6fik+lSE+tqfFhvt/EwT8q/oMtJbP9CjXI= github.com/jackc/pgx/v4 v4.7.1/go.mod h1:nu42q3aPjuC1M0Nak4bnoprKlXPINqopEKqbq5AZSC4= github.com/jackc/pgx/v4 v4.7.2 h1:0DJC1AiqH0Lba79JHFQkcoxi0sOAn75Zr+QCRCAXvBc= github.com/jackc/pgx/v4 v4.7.2/go.mod h1:IaoCMFiHwe2J7SjRZ97Qc7zr8QGNwnlAU4J0f3S1UYk= @@ -437,10 +411,8 @@ github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8 github.com/kennygrant/sanitize v1.2.4/go.mod h1:LGsjYYtgxbetdg5owWB2mpgUL6e2nfw2eObZ0u0qvak= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.10.6 h1:SP6zavvTG3YjOosWePXFDlExpKIWMTO4SE/Y8MZB2vI= github.com/klauspost/compress v1.10.6/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.10.11 h1:K9z59aO18Aywg2b/WSgBaUX99mHy2BES18Cr5lBKZHk= github.com/klauspost/compress v1.10.11/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= @@ -453,7 +425,6 @@ github.com/knqyf263/go-deb-version v0.0.0-20190517075300-09fca494f03d/go.mod h1: github.com/knqyf263/go-rpm-version v0.0.0-20170716094938-74609b86c936 h1:HDjRqotkViMNcGMGicb7cgxklx8OwnjtCBmyWEqrRvM= github.com/knqyf263/go-rpm-version v0.0.0-20170716094938-74609b86c936/go.mod h1:i4sF0l1fFnY1aiw08QQSwVAFxHEm311Me3WsU/X7nL0= 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.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/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= @@ -469,7 +440,6 @@ github.com/ldelossa/responserecorder v1.0.1/go.mod h1:NGV7dXE6J4C7+RyXmtYcKuCafu github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -484,7 +454,6 @@ github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7 github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -493,7 +462,6 @@ github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-isatty v0.0.10 h1:qxFzApOv4WsAL965uUPIsXzAKCZxN2p9UqdhFS4ZW10= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -510,13 +478,11 @@ github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88J 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= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -541,12 +507,10 @@ github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= @@ -576,7 +540,6 @@ github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0 github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/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= @@ -595,15 +558,12 @@ github.com/prometheus/client_golang v1.9.0 h1:Rrch9mh17XcxvEu9D9DEpb4isxjGBtcevQ github.com/prometheus/client_golang v1.9.0/go.mod h1:FqZLKOZnGdFAhOK4nqGHa7D66IdsO+O441Eve7ptJDU= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.1 h1:K0MGApIoQvMw27RTdJkPbr3JZ7DNbtxQNyi5STVM6Kw= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= @@ -614,10 +574,8 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= -github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.3.0 h1:Uehi/mxLK0eiUc0H0++5tpMGTexB8wZ598MIgU8VpDM= github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= @@ -689,7 +647,6 @@ github.com/stretchr/testify v0.0.0-20151208002404-e3a8ff8ce365/go.mod h1:a8OnRci github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -809,7 +766,6 @@ golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0 h1:8pl+sMODzuvGJkmj2W4kZihvVb5mKm8pB/X44PIQHv8= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -868,9 +824,7 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -928,7 +882,6 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e h1:AyodaIpKjppX+cBfTASF2E1US3H2JFBj920Ot3rtDjs= golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210122093101-04d7465088b8 h1:de2yTH1xuxjmGB7i6Z5o2z3RCHVa0XlpSZzjd8Fe6bE= golang.org/x/sys v0.0.0-20210122093101-04d7465088b8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -937,7 +890,6 @@ golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fq golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -1012,7 +964,6 @@ golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1045,7 +996,6 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= @@ -1074,7 +1024,6 @@ google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200521103424-e9a78aa275b7 h1:JUs1uIDQ46c7iI0QuMPzAHqXaSmqKF0f9freFMk2ivs= google.golang.org/genproto v0.0.0-20200521103424-e9a78aa275b7/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= @@ -1093,19 +1042,16 @@ google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ij google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.24.0 h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s= google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1113,7 +1059,6 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= @@ -1142,7 +1087,6 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/httptransport/affectedmanifesthandler.go b/httptransport/affectedmanifesthandler.go index f9523644a2..a4b8df8577 100644 --- a/httptransport/affectedmanifesthandler.go +++ b/httptransport/affectedmanifesthandler.go @@ -5,7 +5,6 @@ import ( "github.com/quay/claircore" "github.com/quay/claircore/pkg/jsonerr" - "github.com/rs/zerolog" "github.com/quay/clair/v4/indexer" "github.com/quay/clair/v4/internal/codec" @@ -14,11 +13,6 @@ import ( func AffectedManifestHandler(serv indexer.Affected) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { ctx := r.Context() - log := zerolog.Ctx(ctx).With(). - Str("method", "index"). - Logger() - ctx = log.WithContext(ctx) - if r.Method != http.MethodPost { resp := &jsonerr.Response{ Code: "method-not-allowed", diff --git a/httptransport/notificationshandler.go b/httptransport/notificationshandler.go index cc1204eaae..b0e7ee93e6 100644 --- a/httptransport/notificationshandler.go +++ b/httptransport/notificationshandler.go @@ -8,7 +8,9 @@ import ( "github.com/google/uuid" je "github.com/quay/claircore/pkg/jsonerr" - "github.com/rs/zerolog" + "github.com/quay/zlog" + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/label" "github.com/quay/clair/v4/internal/codec" "github.com/quay/clair/v4/notifier" @@ -50,8 +52,9 @@ func (h *NotifHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } func (h *NotifHandler) Delete(w http.ResponseWriter, r *http.Request) { - ctx := r.Context() - log := zerolog.Ctx(ctx) + ctx := baggage.ContextWithValues(r.Context(), + label.String("component", "httptransport/NotifHander.Delete"), + ) path := r.URL.Path id := filepath.Base(path) notificationID, err := uuid.Parse(id) @@ -60,7 +63,7 @@ func (h *NotifHandler) Delete(w http.ResponseWriter, r *http.Request) { Code: "bad-request", Message: fmt.Sprintf("could not parse notification id: %v", err), } - log.Warn().Err(err).Msg("could not parse notification id") + zlog.Warn(ctx).Err(err).Msg("could not parse notification id") je.Error(w, resp, http.StatusBadRequest) return } @@ -71,15 +74,16 @@ func (h *NotifHandler) Delete(w http.ResponseWriter, r *http.Request) { Code: "internal-server-error", Message: fmt.Sprintf("could not delete notification: %v", err), } - log.Warn().Err(err).Msg("could not delete notification") + zlog.Warn(ctx).Err(err).Msg("could not delete notification") je.Error(w, resp, http.StatusInternalServerError) } } -// NotificaitonsHandler will return paginated notifications to the caller. +// Get will return paginated notifications to the caller. func (h *NotifHandler) Get(w http.ResponseWriter, r *http.Request) { - ctx := r.Context() - log := zerolog.Ctx(ctx) + ctx := baggage.ContextWithValues(r.Context(), + label.String("component", "httptransport/NotifHander.Get"), + ) path := r.URL.Path id := filepath.Base(path) notificationID, err := uuid.Parse(id) @@ -88,7 +92,7 @@ func (h *NotifHandler) Get(w http.ResponseWriter, r *http.Request) { Code: "bad-request", Message: fmt.Sprintf("could not parse notification id: %v", err), } - log.Warn().Err(err).Msg("could not parse notification id") + zlog.Warn(ctx).Err(err).Msg("could not parse notification id") je.Error(w, resp, http.StatusBadRequest) return } diff --git a/httptransport/server.go b/httptransport/server.go index 5af1d93b5f..0c6cd3bda3 100644 --- a/httptransport/server.go +++ b/httptransport/server.go @@ -5,9 +5,11 @@ import ( "net" "net/http" - "github.com/rs/zerolog" + "github.com/quay/zlog" othttp "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/label" clairerror "github.com/quay/clair/v4/clair-error" "github.com/quay/clair/v4/config" @@ -52,11 +54,6 @@ type Server struct { } func New(ctx context.Context, conf config.Config, indexer indexer.Service, matcher matcher.Service, notifier notifier.Service) (*Server, error) { - log := zerolog.Ctx(ctx).With(). - Str("component", "init/NewHttpTransport"). - Logger() - ctx = log.WithContext(ctx) - serv := &http.Server{ Addr: conf.HTTPListenAddr, // use the passed in global context as the base context @@ -73,11 +70,14 @@ func New(ctx context.Context, conf config.Config, indexer indexer.Service, match notifier: notifier, traceOpt: othttp.WithTracerProvider(otel.GetTracerProvider()), } + ctx = baggage.ContextWithValues(ctx, + label.String("component", "httptransport/New"), + ) if err := t.configureDiscovery(ctx); err != nil { - log.Warn().Err(err).Msg("configuring openapi discovery failed") + zlog.Warn(ctx).Err(err).Msg("configuring openapi discovery failed") } else { - log.Info().Str("path", OpenAPIV1Path).Msg("openapi discovery configured") + zlog.Info(ctx).Str("path", OpenAPIV1Path).Msg("openapi discovery configured") } var e error @@ -112,7 +112,9 @@ func New(ctx context.Context, conf config.Config, indexer indexer.Service, match if conf.Auth.Any() { err := t.configureWithAuth(ctx) if err != nil { - log.Warn().Err(err).Msg("received error configuring auth middleware") + zlog.Warn(ctx). + Err(err). + Msg("received error configuring auth middleware") } } diff --git a/httptransport/updateoperationhandler.go b/httptransport/updateoperationhandler.go index 4ac33951e0..b20cc8cd69 100644 --- a/httptransport/updateoperationhandler.go +++ b/httptransport/updateoperationhandler.go @@ -9,7 +9,9 @@ import ( "github.com/google/uuid" "github.com/quay/claircore/libvuln/driver" je "github.com/quay/claircore/pkg/jsonerr" - "github.com/rs/zerolog" + "github.com/quay/zlog" + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/label" "github.com/quay/clair/v4/internal/codec" "github.com/quay/clair/v4/matcher" @@ -56,7 +58,9 @@ func (h *UOHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { // Clients may provide an 'If-None-Match' header with the etag value to receive // a StatusNotModified when no new UpdateOperations have been created. func (h *UOHandler) Get(w http.ResponseWriter, r *http.Request) { - ctx := r.Context() + ctx := baggage.ContextWithValues(r.Context(), + label.String("component", "httptransport/UOHandler.Get"), + ) // handle conditional request. this is an optimization if ref, err := h.serv.LatestUpdateOperation(ctx); err == nil { validator := `"` + ref.String() + `"` @@ -93,8 +97,9 @@ func (h *UOHandler) Get(w http.ResponseWriter, r *http.Request) { // Delete removes an UpdateOperation models from the system. func (h *UOHandler) Delete(w http.ResponseWriter, r *http.Request) { - ctx := r.Context() - log := zerolog.Ctx(ctx) + ctx := baggage.ContextWithValues(r.Context(), + label.String("component", "httptransport/UOHandler.Delete"), + ) path := r.URL.Path id := filepath.Base(path) uuid, err := uuid.Parse(id) @@ -103,7 +108,7 @@ func (h *UOHandler) Delete(w http.ResponseWriter, r *http.Request) { Code: "bad-request", Message: fmt.Sprintf("could not deserialize manifest: %v", err), } - log.Warn().Err(err).Msg("could not deserialize manifest") + zlog.Warn(ctx).Err(err).Msg("could not deserialize manifest") je.Error(w, resp, http.StatusBadRequest) return } diff --git a/initialize/logging.go b/initialize/logging.go index c9ac4910f0..bc6ae2efbc 100644 --- a/initialize/logging.go +++ b/initialize/logging.go @@ -5,43 +5,41 @@ import ( "os" "strings" + "github.com/quay/zlog" "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/quay/clair/v4/config" ) -// LogLevel does a string-to-level mapping. -func LogLevel(level string) zerolog.Level { - level = strings.ToLower(level) - switch level { +// Logging configures zlog according to the provided configuration. +func Logging(ctx context.Context, cfg *config.Config) error { + l := zerolog.New(os.Stderr) + switch strings.ToLower(cfg.LogLevel) { case "debug-color": - // set global logger to use ConsoleWriter for colorized output - log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}) - return zerolog.DebugLevel + // set logger to use ConsoleWriter for colorized output + l = l.Level(zerolog.DebugLevel). + Output(zerolog.ConsoleWriter{Out: os.Stderr}) case "debug": - return zerolog.DebugLevel + l = l.Level(zerolog.DebugLevel) case "info": - return zerolog.InfoLevel + l = l.Level(zerolog.InfoLevel) case "warn": - return zerolog.WarnLevel + l = l.Level(zerolog.WarnLevel) case "error": - return zerolog.ErrorLevel + l = l.Level(zerolog.ErrorLevel) case "fatal": - return zerolog.FatalLevel + l = l.Level(zerolog.FatalLevel) case "panic": - return zerolog.PanicLevel + l = l.Level(zerolog.PanicLevel) default: - return zerolog.InfoLevel + l = l.Level(zerolog.InfoLevel) } -} - -// Logging configures a logger according to the provided configuration and returns -// a configured Context. -func Logging(ctx context.Context, cfg *config.Config) (context.Context, error) { - zerolog.SetGlobalLevel(LogLevel(cfg.LogLevel)) - l := log.With().Timestamp().Logger() - ctx = l.WithContext(ctx) + l = l.With(). + Timestamp(). + Logger() + zlog.Set(&l) + log.Logger = zerolog.Nop() l.Debug().Str("component", "initialize/Logging").Msg("logging initialized") - return ctx, nil + return nil } diff --git a/initialize/services.go b/initialize/services.go index 84c4c9b2f4..5f841b63ae 100644 --- a/initialize/services.go +++ b/initialize/services.go @@ -9,7 +9,9 @@ import ( "github.com/quay/claircore/libindex" "github.com/quay/claircore/libvuln" "github.com/quay/claircore/libvuln/driver" - "github.com/rs/zerolog" + "github.com/quay/zlog" + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/label" "gopkg.in/square/go-jose.v2/jwt" clairerror "github.com/quay/clair/v4/clair-error" @@ -45,9 +47,11 @@ type Srv struct { // Services configures the services needed for a given mode according to the // provided configuration. func Services(ctx context.Context, cfg *config.Config) (*Srv, error) { - log := zerolog.Ctx(ctx).With().Str("component", "init/Services").Logger() - log.Info().Msg("begin service initialization") - defer log.Info().Msg("end service initialization") + ctx = baggage.ContextWithValues(ctx, + label.String("component", "initialize/Services"), + ) + zlog.Info(ctx).Msg("begin service initialization") + defer zlog.Info(ctx).Msg("end service initialization") var srv Srv var err error diff --git a/introspection/server.go b/introspection/server.go index a7c2a9e4d5..4c2511fd89 100644 --- a/introspection/server.go +++ b/introspection/server.go @@ -8,7 +8,7 @@ import ( "net/http/pprof" "github.com/prometheus/client_golang/prometheus/promhttp" - "github.com/rs/zerolog" + "github.com/quay/zlog" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/baggage" "go.opentelemetry.io/otel/exporters/stdout" @@ -17,7 +17,6 @@ import ( sdktrace "go.opentelemetry.io/otel/sdk/trace" "github.com/quay/clair/v4/config" - "github.com/quay/zlog" ) const ( @@ -46,12 +45,16 @@ type Server struct { } func New(ctx context.Context, conf config.Config, health func() bool) (*Server, error) { - logger := zerolog.Ctx(ctx).With().Str("component", "introspection").Logger() + ctx = baggage.ContextWithValues(ctx, + label.String("component", "introspection/New"), + ) var addr string if conf.IntrospectionAddr == "" { addr = DefaultIntrospectionAddr - logger.Info().Str("address", addr).Msg("no introspection address provied. using default") + zlog.Info(ctx). + Str("address", addr). + Msg("no introspection address provided; using default") } else { addr = conf.IntrospectionAddr } @@ -67,7 +70,7 @@ func New(ctx context.Context, conf config.Config, health func() bool) (*Server, // check for health if health == nil { - logger.Warn().Msg("no health check configured; unconditionally reporting OK") + zlog.Warn(ctx).Msg("no health check configured; unconditionally reporting OK") i.health = func() bool { return true } } @@ -111,7 +114,7 @@ func New(ctx context.Context, conf config.Config, health func() bool) (*Server, return nil, fmt.Errorf("error configuring jaeger tracing: %v", err) } default: - logger.Info().Msg("no distributed tracing enabled") + zlog.Info(ctx).Msg("no distributed tracing enabled") } // configure diagnostics @@ -160,9 +163,6 @@ func (i *Server) withStdOut(_ context.Context, traceOpts []sdktrace.TracerProvid // withJaeger configures the Jaeger exporter for distributed tracing. func (i *Server) withJaeger(ctx context.Context, traceOpts []sdktrace.TracerProviderOption) error { - logger := zerolog.Ctx(ctx).With(). - Str("component", "introspection/Introspection.withJaeger"). - Logger() conf := i.conf.Trace.Jaeger var mode string var endpoint string @@ -180,14 +180,18 @@ func (i *Server) withJaeger(ctx context.Context, traceOpts []sdktrace.TracerProv mode = "agent" endpoint = DefaultJaegerEndpoint } + ctx = baggage.ContextWithValues(ctx, + label.String("component", "introspection/Server.withJaeger"), + label.String("endpoint", endpoint), + ) var e jaeger.EndpointOption switch mode { case "agent": - logger.Info().Str("endpoint", endpoint).Msg("configuring jaeger exporter to push to agent") + zlog.Info(ctx).Msg("configuring jaeger exporter to push to agent") e = jaeger.WithAgentEndpoint(endpoint) case "collector": - logger.Info().Str("endpoint", endpoint).Msg("configuring jaeger exporter to push to collector") + zlog.Info(ctx).Msg("configuring jaeger exporter to push to collector") var opt []jaeger.CollectorEndpointOption u, p := conf.Collector.Username, conf.Collector.Password if u != nil { @@ -234,13 +238,14 @@ func (i *Server) withJaeger(ctx context.Context, traceOpts []sdktrace.TracerProv // endpoint to i's servemux. func (i *Server) withPrometheus(ctx context.Context) error { ctx = baggage.ContextWithValues(ctx, - label.String("component", "introspection/Introspection.withPrometheus"), + label.String("component", "introspection/Server.withPrometheus"), ) endpoint := DefaultPromEndpoint if i.conf.Metrics.Prometheus.Endpoint != nil { endpoint = *i.conf.Metrics.Prometheus.Endpoint } - zlog.Info(ctx).Str("endpoint", endpoint). + zlog.Info(ctx). + Str("endpoint", endpoint). Str("server", i.Addr). Msg("configuring prometheus") diff --git a/middleware/auth/httpauth_psk.go b/middleware/auth/httpauth_psk.go index 26dc5c1105..62940f6f89 100644 --- a/middleware/auth/httpauth_psk.go +++ b/middleware/auth/httpauth_psk.go @@ -5,7 +5,9 @@ import ( "net/http" "time" - "github.com/rs/zerolog" + "github.com/quay/zlog" + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/label" "gopkg.in/square/go-jose.v2/jwt" ) @@ -28,32 +30,31 @@ func NewPSK(key []byte, issuer []string) (*PSK, error) { // Check implements AuthCheck func (p *PSK) Check(_ context.Context, r *http.Request) bool { - ctx := r.Context() - log := zerolog.Ctx(ctx).With(). - Str("component", "middleware/auth/PSK.Check"). - Logger() - ctx = log.WithContext(ctx) + ctx := baggage.ContextWithValues(r.Context(), + label.String("component", "middleware/auth/PSK.Check"), + ) wt, ok := fromHeader(r) if !ok { - log.Debug().Msg("failed to retrieve jwt from header") + zlog.Debug(ctx).Msg("failed to retrieve jwt from header") return false } tok, err := jwt.ParseSigned(wt) if err != nil { - log.Debug().Err(err).Msg("failed to parse jwt") + zlog.Debug(ctx).Err(err).Msg("failed to parse jwt") return false } cl := jwt.Claims{} if err := tok.Claims(p.key, &cl); err != nil { - log.Debug().Err(err).Msg("failed to parse jwt") + zlog.Debug(ctx).Err(err).Msg("failed to parse jwt") return false } + ctx = baggage.ContextWithValues(ctx, label.String("iss", cl.Issuer)) if err := cl.ValidateWithLeeway(jwt.Expected{ Time: time.Now(), }, 15*time.Second); err != nil { - log.Debug().Err(err).Str("iss", cl.Issuer).Msg("could not validate claims") + zlog.Debug(ctx).Err(err).Msg("could not validate claims") return false } @@ -62,7 +63,7 @@ func (p *PSK) Check(_ context.Context, r *http.Request) bool { break } if i == len(p.iss)-1 { - log.Debug().Err(err).Str("iss", cl.Issuer).Msg("could not verify issuer") + zlog.Debug(ctx).Err(err).Msg("could not verify issuer") return false } } diff --git a/notifier/amqp/failover.go b/notifier/amqp/failover.go index de8954c42f..b00b6f9427 100644 --- a/notifier/amqp/failover.go +++ b/notifier/amqp/failover.go @@ -5,8 +5,10 @@ import ( "fmt" "sync" - "github.com/rs/zerolog" + "github.com/quay/zlog" samqp "github.com/streadway/amqp" + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/label" ) // failOver will return the first successful connection made against the provided @@ -25,20 +27,21 @@ type failOver struct { // f's Config field must have it's Validate() method called before this method // is used. func (f *failOver) Connection(ctx context.Context) (*samqp.Connection, error) { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/amqp/failover"). - Logger() - ctx = log.WithContext(ctx) + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/amqp/failOver.Connection"), + ) f.RLock() if f.conn != nil && !f.conn.IsClosed() { - log.Debug().Msg("existing connection exist and is not closed. returning this connection") + zlog.Debug(ctx). + Msg("existing connection exist and is not closed. returning this connection") f.RUnlock() return f.conn, nil } f.RUnlock() for _, uri := range f.URIs { + ctx := baggage.ContextWithValues(ctx, label.String("broker", uri)) // safe to always call DialTLS per docs: // 'DialTLS will use the provided tls.Config when it encounters an amqps:// scheme and will dial a plain connection when it encounters an amqp:// scheme.' conn, err := samqp.DialTLS(uri, f.tls) @@ -46,7 +49,8 @@ func (f *failOver) Connection(ctx context.Context) (*samqp.Connection, error) { if conn != nil { conn.Close() } - log.Info().Str("broker", uri).Msg("failed to connect to AMQP broker. attempting next broker") + zlog.Info(ctx). + Msg("failed to connect to AMQP broker. attempting next broker") continue } ch, err := conn.Channel() @@ -54,7 +58,8 @@ func (f *failOver) Connection(ctx context.Context) (*samqp.Connection, error) { if conn != nil { conn.Close() } - log.Info().Str("broker", uri).Msg("could not obtain initial AMQP channel for passive exchange declare. attempting next broker") + zlog.Info(ctx). + Msg("could not obtain initial AMQP channel for passive exchange declare. attempting next broker") continue } // if the name is "" it's the default exchange which @@ -74,7 +79,8 @@ func (f *failOver) Connection(ctx context.Context) (*samqp.Connection, error) { if conn != nil { conn.Close() } - log.Info().Str("broker", uri).Msg("could not obtain initial AMQP channel for passive exchange declare. attempting next broker") + zlog.Info(ctx). + Msg("could not obtain initial AMQP channel for passive exchange declare. attempting next broker") continue } } diff --git a/notifier/delivery.go b/notifier/delivery.go index 98be245a2d..c98a6caf8f 100644 --- a/notifier/delivery.go +++ b/notifier/delivery.go @@ -6,9 +6,12 @@ import ( "time" "github.com/google/uuid" - clairerror "github.com/quay/clair/v4/clair-error" "github.com/quay/claircore/pkg/distlock" - "github.com/rs/zerolog" + "github.com/quay/zlog" + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/label" + + clairerror "github.com/quay/clair/v4/clair-error" ) // Delivery handles the business logic of delivering @@ -23,7 +26,7 @@ type Delivery struct { // distributed lock used for mutual exclusion distLock distlock.Locker // a integer id used for logging - id uint8 + id int } func NewDelivery(id int, d Deliverer, interval time.Duration, store Store, distLock distlock.Locker) *Delivery { @@ -32,7 +35,7 @@ func NewDelivery(id int, d Deliverer, interval time.Duration, store Store, distL interval: interval, store: store, distLock: distLock, - id: uint8(id), + id: id, } } @@ -40,10 +43,13 @@ func NewDelivery(id int, d Deliverer, interval time.Duration, store Store, distL // // Canceling the ctx will end delivery. func (d *Delivery) Deliver(ctx context.Context) { - log := zerolog.Ctx(ctx).With().Uint8("id", d.id). - Str("deliverer", d.Deliverer.Name()). - Str("component", "notifier/delivery/Delivery.Deliver").Logger() - log.Info().Msg("delivering notifications") + ctx = baggage.ContextWithValues(ctx, + label.String("deliverer", d.Deliverer.Name()), + label.String("component", "notifier/Delivery.Deliver"), + label.Int("id", d.id), + ) + zlog.Info(ctx). + Msg("delivering notifications") go d.deliver(ctx) } @@ -51,10 +57,9 @@ func (d *Delivery) Deliver(ctx context.Context) { // // implements a blocking event loop via a time.Ticker func (d *Delivery) deliver(ctx context.Context) error { - log := zerolog.Ctx(ctx).With(). - Str("deliverer", d.Deliverer.Name()). - Uint8("id", d.id). - Str("component", "notifier/delivery/Delivery.deliver").Logger() + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/Delivery.deliver"), + ) ticker := time.NewTicker(d.interval) defer ticker.Stop() @@ -63,10 +68,13 @@ func (d *Delivery) deliver(ctx context.Context) error { case <-ctx.Done(): return ctx.Err() case <-ticker.C: - log.Debug().Msg("delivery tick") + zlog.Debug(ctx). + Msg("delivery tick") err := d.RunDelivery(ctx) if err != nil { - log.Error().Err(err).Msg("encountered error on tick") + zlog.Error(ctx). + Err(err). + Msg("encountered error on tick") } } } @@ -75,25 +83,34 @@ func (d *Delivery) deliver(ctx context.Context) error { // RunDelivery determines notifications to deliver and // calls the implemented Deliverer to perform the actions. func (d *Delivery) RunDelivery(ctx context.Context) error { - log := zerolog.Ctx(ctx).With(). - Str("deliverer", d.Deliverer.Name()). - Uint8("id", d.id). - Str("component", "notifier/delivery/Delivery.RunDelivery").Logger() + ctx = baggage.ContextWithValues(ctx, + label.String("deliverer", d.Deliverer.Name()), + label.Int("id", d.id), + label.String("component", "notifier/Delivery.RunDelivery"), + ) toDeliver := []uuid.UUID{} // get created - if created, err := d.store.Created(ctx); err != nil { + created, err := d.store.Created(ctx) + if err != nil { return err - } else { - log.Info().Int("created", len(created)).Msg("notification ids in created status") + } + if sz := len(created); sz != 0 { + zlog.Info(ctx). + Int("created", sz). + Msg("notification ids in created status") toDeliver = append(toDeliver, created...) } // get failed - if failed, err := d.store.Failed(ctx); err != nil { + failed, err := d.store.Failed(ctx) + if err != nil { return err - } else { - log.Info().Int("failed", len(failed)).Msg("notification ids in failed status") + } + if sz := len(failed); sz != 0 { + zlog.Info(ctx). + Int("failed", sz). + Msg("notification ids in failed status") toDeliver = append(toDeliver, failed...) } @@ -104,7 +121,9 @@ func (d *Delivery) RunDelivery(ctx context.Context) error { return err } if !ok { - log.Debug().Str("notification_id", nID.String()).Msg("another process is deliverying this notification") + zlog.Debug(ctx). + Stringer("notification_id", nID). + Msg("another process is delivering this notification") // another process is working on this notification continue } @@ -123,14 +142,15 @@ func (d *Delivery) RunDelivery(ctx context.Context) error { // // do's actions should be performed under a distributed lock. func (d *Delivery) do(ctx context.Context, nID uuid.UUID) error { - log := zerolog.Ctx(ctx).With(). - Str("deliverer", d.Deliverer.Name()). - Uint8("id", d.id). - Str("component", "notifier/delivery/Delivery.do").Logger() + ctx = baggage.ContextWithValues(ctx, + label.Stringer("notification_id", nID), + label.String("component", "notifier/Delivery.do"), + ) // if we have a direct deliverer provide the notifications to it. if dd, ok := d.Deliverer.(DirectDeliverer); ok { - log.Debug().Msg("providing direct deliverer notifications") + zlog.Debug(ctx). + Msg("providing direct deliverer notifications") notifications, _, err := d.store.Notifications(ctx, nID, nil) if err != nil { return err @@ -148,7 +168,8 @@ func (d *Delivery) do(ctx context.Context, nID uuid.UUID) error { if errors.As(err, &dErr) { // OK for this to fail, notification will stay in Created status. // store is failing, lets back off it tho until next tick. - log.Info().Str("notifcation_id", nID.String()).Msg("failed to deliver notifications") + zlog.Info(ctx). + Msg("failed to deliver notifications") err := d.store.SetDeliveryFailed(ctx, nID) if err != nil { return err @@ -172,6 +193,7 @@ func (d *Delivery) do(ctx context.Context, nID uuid.UUID) error { return err } } - log.Info().Str("notifcation_id", nID.String()).Msg("successfully delivered notifications") + zlog.Info(ctx). + Msg("successfully delivered notifications") return nil } diff --git a/notifier/keymanager/manager.go b/notifier/keymanager/manager.go index 592b4190f0..b7ba085b25 100644 --- a/notifier/keymanager/manager.go +++ b/notifier/keymanager/manager.go @@ -12,9 +12,12 @@ import ( "time" "github.com/google/uuid" + "github.com/quay/zlog" + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/label" + clairerror "github.com/quay/clair/v4/clair-error" "github.com/quay/clair/v4/notifier" - "github.com/rs/zerolog" ) const ( @@ -59,9 +62,9 @@ type Manager struct { // // Ensure cancelation of ctx to avoid go routine leakage. func NewManager(ctx context.Context, store notifier.KeyStore) (*Manager, error) { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/keymanager/NewManager"). - Logger() + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/keymanager/NewManager"), + ) var m *Manager = &Manager{ kp: atomic.Value{}, @@ -80,7 +83,8 @@ func NewManager(ctx context.Context, store notifier.KeyStore) (*Manager, error) // kick off event loop go m.loop(ctx) - log.Info().Msg("key manager initialized.") + zlog.Info(ctx). + Msg("key manager initialized") return m, nil } @@ -98,9 +102,9 @@ func (m *Manager) KeyPair() (KeyPair, error) { // genKeyPair creates a RSA key pair. func (m *Manager) genKeyPair(ctx context.Context) (KeyPair, error) { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/keymanager/Manager.genKeyPair"). - Logger() + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/keymanager/Manager.genKeyPair"), + ) reader := cRand.Reader key, err := rsa.GenerateKey(reader, bitSize) @@ -114,7 +118,9 @@ func (m *Manager) genKeyPair(ctx context.Context) (KeyPair, error) { id := uuid.New() - log.Debug().Str("id", id.String()).Msg("new key pair generated") + zlog.Debug(ctx). + Stringer("id", id). + Msg("new key pair generated") return KeyPair{ ID: id, Private: key, @@ -125,9 +131,9 @@ func (m *Manager) genKeyPair(ctx context.Context) (KeyPair, error) { // loop is a blocking event loop. func (m *Manager) loop(ctx context.Context) { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/keymanager/Manager.loop"). - Logger() + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/keymanager/Manager.loop"), + ) t := time.NewTicker(interval) defer t.Stop() for { @@ -135,9 +141,11 @@ func (m *Manager) loop(ctx context.Context) { case <-ctx.Done(): return case <-t.C: - log.Debug().Msg("keymanager tick") + zlog.Debug(ctx).Msg("keymanager tick") err := m.bump(ctx) - log.Error().Err(err).Msg("received error when bumping public key expiration") + zlog.Error(ctx). + Err(err). + Msg("received error when bumping public key expiration") // 1/4 chance of running gc if rand.Int()%4 == 0 { @@ -148,22 +156,27 @@ func (m *Manager) loop(ctx context.Context) { } func (m *Manager) gc(ctx context.Context) { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/keymanager/Manager.gc"). - Logger() + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/keymanager/Manager.gc"), + ) - log.Info().Msg("gc starting") + zlog.Info(ctx). + Msg("gc starting") var total int64 var err error var n int64 = -1 for n != 0 { n, err = m.store.GC(ctx) if err != nil { - log.Error().Err(err).Msg("received error while performing gc") + zlog.Error(ctx). + Err(err). + Msg("received error while performing gc") } total += n } - log.Info().Int64("deleted", total).Msg("gc complete") + zlog.Info(ctx). + Int64("deleted", total). + Msg("gc complete") } // bump will attempt a bump of the currently managed @@ -171,9 +184,9 @@ func (m *Manager) gc(ctx context.Context) { // // if the key pair is not found a new key pair is created and managed. func (m *Manager) bump(ctx context.Context) error { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/keymanager/Manager.bump"). - Logger() + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/keymanager/Manager.bump"), + ) var kp *KeyPair = (m.kp.Load()).(*KeyPair) if kp == nil { @@ -198,6 +211,8 @@ func (m *Manager) bump(ctx context.Context) error { default: return err } - log.Debug().Str("id", kp.ID.String()).Msg("succesfully bump key expiration") + zlog.Debug(ctx). + Stringer("id", kp.ID). + Msg("successfully bumped key expiration") return nil } diff --git a/notifier/poller.go b/notifier/poller.go index 0bdce01fed..4ebfd321c5 100644 --- a/notifier/poller.go +++ b/notifier/poller.go @@ -5,10 +5,13 @@ import ( "errors" "time" + "github.com/quay/claircore/libvuln/driver" + "github.com/quay/zlog" + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/label" + clairerror "github.com/quay/clair/v4/clair-error" "github.com/quay/clair/v4/matcher" - "github.com/quay/claircore/libvuln/driver" - "github.com/rs/zerolog" ) const ( @@ -62,13 +65,14 @@ func (p *Poller) Poll(ctx context.Context) <-chan Event { // // implements a blocking event loop via a time.Ticker func (p *Poller) poll(ctx context.Context, c chan<- Event) { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/updatepoller/Poller.poll"). - Logger() + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/Poller.poll"), + ) defer close(c) if err := ctx.Err(); err != nil { - log.Info().Msg("context canceled before polling began") + zlog.Info(ctx). + Msg("context canceled before polling began") return } @@ -78,10 +82,12 @@ func (p *Poller) poll(ctx context.Context, c chan<- Event) { for { select { case <-ctx.Done(): - log.Info().Msg("context canceled. polling ended") + zlog.Info(ctx). + Msg("context canceled. polling ended") return case <-t.C: - log.Debug().Msg("poll interval tick") + zlog.Debug(ctx). + Msg("poll interval tick") p.onTick(ctx, c) } } @@ -90,22 +96,27 @@ func (p *Poller) poll(ctx context.Context, c chan<- Event) { // onTick retrieves the latest update operations for all known // updaters and delivers an event if notification creation is necessary. func (p *Poller) onTick(ctx context.Context, c chan<- Event) { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/updatepoller/Poller.onTick"). - Logger() + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/Poller.onTick"), + ) latest, err := p.differ.LatestUpdateOperations(ctx) if err != nil { - log.Error().Err(err).Msg("client error retreiving latest update operations. backing off until next interval") + zlog.Error(ctx). + Err(err). + Msg("client error retrieving latest update operations. backing off until next interval") return } for updater, uo := range latest { + ctx := baggage.ContextWithValues(ctx, label.String("updater", updater)) if len(uo) == 0 { - log.Debug().Msg("received 0 update operations after polling Matcher") - return + zlog.Debug(ctx). + Msg("received 0 update operations after polling Matcher") + return // Should this be a continue? } latest := uo[0] + ctx = baggage.ContextWithValues(ctx, label.Stringer("UOID", latest.Ref)) // confirm notifications were never created for this UOID. var errNoReceipt clairerror.ErrNoReceipt _, err := p.store.ReceiptByUOID(ctx, latest.Ref) @@ -117,20 +128,16 @@ func (p *Poller) onTick(ctx context.Context, c chan<- Event) { select { case c <- e: default: - log.Warn(). - Str("updater", updater). - Str("UOID", latest.Ref.String()). + zlog.Warn(ctx). Msg("could not deliver event to channel. skipping updater now") } continue } if err != nil { - log.Error().Err(err). - Str("updater", updater). - Str("UOID", latest.Ref.String()). + zlog.Error(ctx). + Err(err). Msg("received error getting receipt by UOID. backing off till next tick") return } } - return } diff --git a/notifier/postgres/deletenotifications.go b/notifier/postgres/deletenotifications.go index f786574b89..33ce81c8f9 100644 --- a/notifier/postgres/deletenotifications.go +++ b/notifier/postgres/deletenotifications.go @@ -5,16 +5,20 @@ import ( "github.com/google/uuid" "github.com/jackc/pgx/v4/pgxpool" + "github.com/quay/zlog" + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/label" + clairerror "github.com/quay/clair/v4/clair-error" - "github.com/rs/zerolog" ) // deleteNotifications garbage collects notifications and their associated // id and receipt rows func deleteNotifications(ctx context.Context, pool *pgxpool.Pool, id uuid.UUID) error { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/postgres/deleteNotification"). - Logger() + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/postgres/deleteNotifications"), + label.Stringer("notification_id", id), + ) const ( deleteNotificationID = `DELETE FROM notification WHERE id = $1` @@ -32,7 +36,7 @@ func deleteNotifications(ctx context.Context, pool *pgxpool.Pool, id uuid.UUID) return clairerror.ErrDeleteNotification{id, err} } if tag.RowsAffected() <= 0 { - log.Warn().Str("notification_id", id.String()).Msg("no notification bodies deleted") + zlog.Warn(ctx).Msg("no notification bodies deleted") } tag, err = tx.Exec(ctx, deleteReceipt, id.String()) @@ -40,7 +44,7 @@ func deleteNotifications(ctx context.Context, pool *pgxpool.Pool, id uuid.UUID) return clairerror.ErrDeleteNotification{id, err} } if tag.RowsAffected() <= 0 { - log.Warn().Str("notification_id", id.String()).Msg("no notification receipt deleted") + zlog.Warn(ctx).Msg("no notification receipt deleted") } tag, err = tx.Exec(ctx, deleteNotificationID, id.String()) @@ -48,7 +52,7 @@ func deleteNotifications(ctx context.Context, pool *pgxpool.Pool, id uuid.UUID) return clairerror.ErrDeleteNotification{id, err} } if tag.RowsAffected() <= 0 { - log.Warn().Str("notification_id", id.String()).Msg("no notification id deleted") + zlog.Warn(ctx).Msg("no notification id deleted") } err = tx.Commit(ctx) diff --git a/notifier/postgres/keystore.go b/notifier/postgres/keystore.go index 3ec96b91ee..5b2a663fef 100644 --- a/notifier/postgres/keystore.go +++ b/notifier/postgres/keystore.go @@ -10,9 +10,12 @@ import ( "github.com/google/uuid" "github.com/jackc/pgx/v4" "github.com/jackc/pgx/v4/pgxpool" + "github.com/quay/zlog" + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/label" + clairerror "github.com/quay/clair/v4/clair-error" "github.com/quay/clair/v4/notifier" - "github.com/rs/zerolog" ) var _ notifier.KeyStore = (*KeyStore)(nil) @@ -30,9 +33,9 @@ func NewKeyStore(pool *pgxpool.Pool) *KeyStore { } func (k *KeyStore) Keys(ctx context.Context) ([]notifier.Key, error) { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/postgres/keystore.Keys"). - Logger() + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/postgres/KeyStore.Keys"), + ) const ( query = `SELECT id, expiration, pub_key FROM key WHERE expiration > CURRENT_TIMESTAMP;` ) @@ -59,7 +62,9 @@ func (k *KeyStore) Keys(ctx context.Context) ([]notifier.Key, error) { tmps = append(tmps, t) } rows.Close() - log.Debug().Int("len", len(tmps)).Msg("discovered keys") + zlog.Debug(ctx). + Int("len", len(tmps)). + Msg("discovered keys") // process tmp keys, rows are closed so time taken here // won't starve conn pool. @@ -120,7 +125,7 @@ func (k *KeyStore) PutKey(ctx context.Context, ID uuid.UUID, key *rsa.PublicKey, return err } if tag.RowsAffected() <= 0 { - return fmt.Errorf("insertion did ont affect any rows") + return fmt.Errorf("insertion did not affect any rows") } return nil } diff --git a/notifier/postgres/notifications.go b/notifier/postgres/notifications.go index 369cb0ec11..58a0bb7266 100644 --- a/notifier/postgres/notifications.go +++ b/notifier/postgres/notifications.go @@ -5,9 +5,9 @@ import ( "github.com/google/uuid" "github.com/jackc/pgx/v4/pgxpool" + clairerror "github.com/quay/clair/v4/clair-error" "github.com/quay/clair/v4/notifier" - "github.com/rs/zerolog" ) func notifications(ctx context.Context, pool *pgxpool.Pool, id uuid.UUID, page *notifier.Page) ([]notifier.Notification, notifier.Page, error) { @@ -15,10 +15,6 @@ func notifications(ctx context.Context, pool *pgxpool.Pool, id uuid.UUID, page * query = "SELECT id, body FROM notification_body WHERE notification_id = $1" pagedQuery = "SELECT id, body FROM notification_body WHERE notification_id = $1 AND id > $2 ORDER BY id ASC LIMIT $3" ) - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/postgres/notifications/notifications"). - Logger() - ctx = log.WithContext(ctx) // if no page argument early return all notifications if page == nil { diff --git a/notifier/processor.go b/notifier/processor.go index 3ff8638c9d..b8c579f1d6 100644 --- a/notifier/processor.go +++ b/notifier/processor.go @@ -10,7 +10,10 @@ import ( "github.com/quay/claircore" "github.com/quay/claircore/libvuln/driver" "github.com/quay/claircore/pkg/distlock" - "github.com/rs/zerolog" + "github.com/quay/zlog" + "github.com/rs/zerolog/log" + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/label" "golang.org/x/sync/errgroup" clairerror "github.com/quay/clair/v4/clair-error" @@ -39,7 +42,7 @@ type Processor struct { // a store instance to persist notifications store Store // a integer id used for logging - id uint8 + id int } func NewProcessor(id int, distLock distlock.Locker, indexer indexer.Service, matcher matcher.Service, store Store) *Processor { @@ -48,7 +51,7 @@ func NewProcessor(id int, distLock distlock.Locker, indexer indexer.Service, mat indexer: indexer, matcher: matcher, store: store, - id: uint8(id), + id: id, } } @@ -65,31 +68,33 @@ func (p *Processor) Process(ctx context.Context, c <-chan Event) { // // implements the blocking event loop of a processor. func (p *Processor) process(ctx context.Context, c <-chan Event) { - log := zerolog.Ctx(ctx).With(). - Uint8("processor_id", p.id). - Str("component", "notifier/processor/Processor.process").Logger() + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/Processor.process"), + label.Int("processor_id", p.id), + ) - log.Debug().Msg("processing events") + zlog.Debug(ctx).Msg("processing events") for { select { case <-ctx.Done(): - log.Info().Msg("context canceled: ending event processing") + zlog.Info(ctx).Msg("context canceled: ending event processing") + return case e := <-c: - uoid := e.uo.Ref.String() - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/processor/Processor.process"). - Str("updater", e.updater). - Str("UOID", uoid). - Uint8("processor_id", p.id). - Logger() - log.Debug().Msg("processing") - locked, err := p.distLock.TryLock(ctx, uoid) + ctx := baggage.ContextWithValues(ctx, + label.String("updater", e.updater), + label.Stringer("UOID", e.uo.Ref), + ) + zlog.Debug(ctx).Msg("processing") + locked, err := p.distLock.TryLock(ctx, e.uo.Ref.String()) if err != nil { - log.Error().Err(err).Msg("received error trying lock. backing off till next UOID") + zlog.Error(ctx). + Err(err). + Msg("received error trying lock. backing off till next UOID") continue } if !locked { - log.Debug().Msg("lock acquired by another processor. will not process") + zlog.Debug(ctx). + Msg("lock acquired by another processor. will not process") continue } // function used to schedule unlock via defer @@ -102,7 +107,9 @@ func (p *Processor) process(ctx context.Context, c <-chan Event) { return p.create(ctx, e, prev) }() if err != nil { - log.Error().Err(err).Msg("failed to create notifications") + zlog.Error(ctx). + Err(err). + Msg("failed to create notifications") } } } @@ -113,19 +120,21 @@ func (p *Processor) process(ctx context.Context, c <-chan Event) { // // will be performed under a distributed lock func (p *Processor) create(ctx context.Context, e Event, prev uuid.UUID) error { - uoid := e.uo.Ref.String() - log := zerolog.Ctx(ctx).With(). - Uint8("processor_id", p.id). - Str("component", "notifier/processor/Processor.create"). - Str("updater", e.updater). - Str("UOID", uoid). - Logger() - log.Debug().Str("prev", prev.String()).Str("cur", uoid).Msg("retrieving diff") + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/Processor.create"), + ) + zlog.Debug(ctx). + Stringer("prev", prev). + Stringer("cur", e.uo.Ref). + Msg("retrieving diff") diff, err := p.matcher.UpdateDiff(ctx, prev, e.uo.Ref) if err != nil { return fmt.Errorf("failed to get update diff: %v", err) } - log.Debug().Int("removed", len(diff.Removed)).Int("added", len(diff.Added)).Msg("diff results") + zlog.Debug(ctx). + Int("removed", len(diff.Removed)). + Int("added", len(diff.Added)). + Msg("diff results") tab := notifTab{ N: make([]Notification, 0), @@ -163,7 +172,8 @@ func (p *Processor) create(ctx context.Context, e Event, prev uuid.UUID) error { UOID: e.uo.Ref, Status: Delivered, } - log.Debug().Str("update_operation", e.uo.Ref.String()).Msg("no affected manifests for update operation, setting to delivered.") + zlog.Debug(ctx). + Msg("no affected manifests for update operation, setting to delivered.") err := p.store.PutReceipt(ctx, e.uo.Updater, r) if err != nil { return fmt.Errorf("failed to put receipt: %v", err) @@ -290,13 +300,9 @@ func getAffected(ctx context.Context, ic indexer.Service, nosummary bool, vs []c // // will be performed under a distributed lock. func (p *Processor) safe(ctx context.Context, e Event) (bool, uuid.UUID) { - uoid := e.uo.Ref.String() - log := zerolog.Ctx(ctx).With(). - Uint8("processor_id", p.id). - Str("component", "notifier/processor/Processor.Process"). - Str("updater", e.updater). - Str("UOID", uoid). - Logger() + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/Processor.safe"), + ) // confirm we are not making duplicate notifications var errNoReceipt clairerror.ErrNoReceipt @@ -305,10 +311,13 @@ func (p *Processor) safe(ctx context.Context, e Event) (bool, uuid.UUID) { case errors.As(err, &errNoReceipt): // hop out of switch case err != nil: - log.Error().Err(err).Msg("received error getting receipt by UOID") + zlog.Error(ctx). + Err(err). + Msg("received error getting receipt by UOID") return false, uuid.Nil default: - log.Info().Msg("receipt created by another processor. will not process notifications") + zlog.Info(ctx). + Msg("receipt created by another processor. will not process notifications") return false, uuid.Nil } @@ -318,11 +327,14 @@ func (p *Processor) safe(ctx context.Context, e Event) (bool, uuid.UUID) { // but code path is not implemented. implement this to optimize. all, err := p.matcher.UpdateOperations(ctx) if err != nil { - log.Error().Err(err).Msg("received error getting update operations from matcher") + zlog.Error(ctx). + Err(err). + Msg("received error getting update operations from matcher") return false, uuid.Nil } if _, ok := all[e.updater]; !ok { - log.Warn().Msg("updater missing from update operations returned from matcher. matcher may have garbage collected") + zlog.Warn(ctx). + Msg("updater missing from update operations returned from matcher. matcher may have garbage collected") return false, uuid.Nil } @@ -339,7 +351,9 @@ func (p *Processor) safe(ctx context.Context, e Event) (bool, uuid.UUID) { } if current.Ref.String() != e.uo.Ref.String() { - log.Info().Str("new", current.Ref.String()).Msg("newer update operation is present, will not process notifications") + zlog.Info(ctx). + Stringer("new", current.Ref). + Msg("newer update operation is present, will not process notifications") return false, uuid.Nil } return true, prev.Ref diff --git a/notifier/service/service.go b/notifier/service/service.go index ac093627b1..b6fc1cf00d 100644 --- a/notifier/service/service.go +++ b/notifier/service/service.go @@ -12,8 +12,10 @@ import ( "github.com/jackc/pgx/v4/pgxpool" _ "github.com/jackc/pgx/v4/stdlib" pgdl "github.com/quay/claircore/pkg/distlock/postgres" + "github.com/quay/zlog" "github.com/remind101/migrate" - "github.com/rs/zerolog" + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/label" "github.com/quay/clair/v4/indexer" "github.com/quay/clair/v4/matcher" @@ -90,10 +92,9 @@ type Opts struct { // Canceling the ctx will kill any concurrent routines affiliated with // the notifier. func New(ctx context.Context, opts Opts) (*service, error) { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/service/Init"). - Logger() - ctx = log.WithContext(ctx) + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/service/New"), + ) // initialize store and dist lock pool store, keystore, lockPool, err := storeInit(ctx, opts) @@ -109,17 +110,23 @@ func New(ctx context.Context, opts Opts) (*service, error) { // check for test mode if tm := os.Getenv("NOTIFIER_TEST_MODE"); tm != "" { - log.Info().Str("interval", opts.PollInterval.String()).Msg("NOTIFIER TEST MODE ENABLED. NOTIFIER WILL CREATE TEST NOTIFICATIONS ON A SET INTERVAL") + zlog.Warn(ctx). + Stringer("interval", opts.PollInterval). + Msg("NOTIFIER TEST MODE ENABLED. NOTIFIER WILL CREATE TEST NOTIFICATIONS ON A SET INTERVAL") testModeInit(ctx, &opts) } // kick off the poller - log.Info().Str("interval", opts.PollInterval.String()).Msg("initializing poller") + zlog.Info(ctx). + Stringer("interval", opts.PollInterval). + Msg("initializing poller") poller := notifier.NewPoller(opts.PollInterval, store, opts.Matcher) c := poller.Poll(ctx) // kick off the processors - log.Info().Int("count", processors).Msg("initializing processors") + zlog.Info(ctx). + Int("count", processors). + Msg("initializing processors") for i := 0; i < processors; i++ { // processors only use try locks distLock := pgdl.NewPool(lockPool, 0) @@ -170,10 +177,9 @@ func testModeInit(ctx context.Context, opts *Opts) error { } func storeInit(ctx context.Context, opts Opts) (*postgres.Store, *postgres.KeyStore, *pgxpool.Pool, error) { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/service/storeInit"). - Logger() - ctx = log.WithContext(ctx) + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/service/storeInit"), + ) cfg, err := pgxpool.ParseConfig(opts.ConnString) if err != nil { @@ -193,7 +199,7 @@ func storeInit(ctx context.Context, opts Opts) (*postgres.Store, *postgres.KeySt // do migrations if requested if opts.Migrations { - log.Info().Msg("performing notifier migrations") + zlog.Info(ctx).Msg("performing notifier migrations") migrator := migrate.NewPostgresMigrator(db) migrator.Table = migrations.MigrationTable err := migrator.Exec(migrate.Up, migrations.Migrations...) @@ -202,19 +208,18 @@ func storeInit(ctx context.Context, opts Opts) (*postgres.Store, *postgres.KeySt } } - log.Info().Msg("initializing notifier store") + zlog.Info(ctx).Msg("initializing notifier store") store := postgres.NewStore(pool) keystore := postgres.NewKeyStore(pool) return store, keystore, pool, nil } func keyManagerInit(ctx context.Context, keystore notifier.KeyStore) (*keymanager.Manager, error) { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/service/keyManagerInit"). - Logger() - ctx = log.WithContext(ctx) + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/service/keyManagerInit"), + ) - log.Debug().Msg("initializing keymanager") + zlog.Debug(ctx).Msg("initializing keymanager") mgr, err := keymanager.NewManager(ctx, keystore) if err != nil { return nil, err @@ -223,11 +228,12 @@ func keyManagerInit(ctx context.Context, keystore notifier.KeyStore) (*keymanage } func webhookDeliveries(ctx context.Context, opts Opts, lockPool *pgxpool.Pool, store notifier.Store, keymanager *keymanager.Manager) error { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/service/webhookInit"). - Logger() - ctx = log.WithContext(ctx) - log.Info().Int("count", deliveries).Msg("initializing webhook deliverers") + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/service/webhookDeliveries"), + ) + zlog.Info(ctx). + Int("count", deliveries). + Msg("initializing webhook deliverers") conf, err := opts.Webhook.Validate() if err != nil { @@ -251,10 +257,9 @@ func webhookDeliveries(ctx context.Context, opts Opts, lockPool *pgxpool.Pool, s } func amqpDeliveries(ctx context.Context, opts Opts, lockPool *pgxpool.Pool, store notifier.Store) error { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/service/amqpInit"). - Logger() - ctx = log.WithContext(ctx) + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/service/amqpDeliveries"), + ) conf, err := opts.AMQP.Validate() if err != nil { @@ -262,7 +267,8 @@ func amqpDeliveries(ctx context.Context, opts Opts, lockPool *pgxpool.Pool, stor } if len(conf.URIs) == 0 { - log.Warn().Msg("amqp delivery was configured with no broker URIs to connect to. delivery of notifications will not occur.") + zlog.Warn(ctx). + Msg("amqp delivery was configured with no broker URIs to connect to. delivery of notifications will not occur.") return nil } @@ -293,10 +299,9 @@ func amqpDeliveries(ctx context.Context, opts Opts, lockPool *pgxpool.Pool, stor } func stompDeliveries(ctx context.Context, opts Opts, lockPool *pgxpool.Pool, store notifier.Store) error { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/service/stompInit"). - Logger() - ctx = log.WithContext(ctx) + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/service/stompDeliveries"), + ) conf, err := opts.STOMP.Validate() if err != nil { @@ -304,7 +309,8 @@ func stompDeliveries(ctx context.Context, opts Opts, lockPool *pgxpool.Pool, sto } if len(conf.URIs) == 0 { - log.Warn().Msg("stomp delivery was configured with no broker URIs to connect to. delivery of notifications will not occur.") + zlog.Warn(ctx). + Msg("stomp delivery was configured with no broker URIs to connect to. delivery of notifications will not occur.") return nil } diff --git a/notifier/stomp/failover.go b/notifier/stomp/failover.go index 5f10b71e93..b1607a8804 100644 --- a/notifier/stomp/failover.go +++ b/notifier/stomp/failover.go @@ -8,7 +8,9 @@ import ( "net" gostomp "github.com/go-stomp/stomp" - "github.com/rs/zerolog" + "github.com/quay/zlog" + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/label" ) // failOver will return the first successful connection made against the provided @@ -64,15 +66,16 @@ func (f *failOver) Dial(uri string) (*gostomp.Conn, error) { // The caller MUST call conn.Disconnect() to close the underlying tcp connection // when finished. func (f *failOver) Connection(ctx context.Context) (*gostomp.Conn, error) { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/stomp/failover"). - Logger() - ctx = log.WithContext(ctx) + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/stomp/failOver.Connection"), + ) for _, uri := range f.URIs { conn, err := f.Dial(uri) if err != nil { - log.Debug().Str("broker", uri).Msg("failed to dial broker. attempting next") + zlog.Debug(ctx). + Str("broker", uri). + Msg("failed to dial broker. attempting next") continue } return conn, nil diff --git a/notifier/webhook/deliverer.go b/notifier/webhook/deliverer.go index 7a66e81339..5fe2d66db2 100644 --- a/notifier/webhook/deliverer.go +++ b/notifier/webhook/deliverer.go @@ -7,7 +7,9 @@ import ( "time" "github.com/google/uuid" - "github.com/rs/zerolog" + "github.com/quay/zlog" + "go.opentelemetry.io/otel/baggage" + "go.opentelemetry.io/otel/label" "gopkg.in/square/go-jose.v2" "gopkg.in/square/go-jose.v2/jwt" @@ -76,10 +78,10 @@ func (d *Deliverer) sign(ctx context.Context, req *http.Request, kp keymanager.K // // Deliver POSTS a webhook data structure to the configured target. func (d *Deliverer) Deliver(ctx context.Context, nID uuid.UUID) error { - log := zerolog.Ctx(ctx).With(). - Str("component", "notifier/webhook/deliverer.Deliver"). - Str("notification_id", nID.String()). - Logger() + ctx = baggage.ContextWithValues(ctx, + label.String("component", "notifier/webhook/Deliverer.Deliver"), + label.Stringer("notification_id", nID), + ) callback, err := d.conf.callback.Parse(nID.String()) if err != nil { @@ -108,12 +110,12 @@ func (d *Deliverer) Deliver(ctx context.Context, nID uuid.UUID) error { if err != nil { return fmt.Errorf("failed to sign request: %v", err) } - log.Debug().Msg("successfully signed request") + zlog.Debug(ctx).Msg("successfully signed request") } - log.Info().Str("notification_id", nID.String()). - Str("callback", callback.String()). - Str("target", d.conf.Target). + zlog.Info(ctx). + Stringer("callback", callback). + Stringer("target", d.conf.target). Msg("dispatching webhook") resp, err := d.c.Do(req)