From 59f65332d0fc3ad27d88749e5eca410f0c0a8f2a Mon Sep 17 00:00:00 2001 From: Daniel Rammer Date: Wed, 2 Nov 2022 07:53:45 -0500 Subject: [PATCH 1/8] initial telemetry imlementation Signed-off-by: Daniel Rammer --- go.mod | 17 +++++---- go.sum | 33 +++++++++++------ storage/cached_rawstore.go | 7 ++++ storage/protobuf_store.go | 7 ++++ telemetryutils/config.go | 52 +++++++++++++++++++++++++++ telemetryutils/factory.go | 74 ++++++++++++++++++++++++++++++++++++++ telemetryutils/utils.go | 22 ++++++++++++ 7 files changed, 196 insertions(+), 16 deletions(-) create mode 100644 telemetryutils/config.go create mode 100644 telemetryutils/factory.go create mode 100644 telemetryutils/utils.go diff --git a/go.mod b/go.mod index 5002bbe..5e03e5a 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,10 @@ require ( github.com/spf13/cobra v1.4.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.11.0 - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/exporters/jaeger v1.11.1 + go.opentelemetry.io/otel/sdk v1.11.1 golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 golang.org/x/tools v0.1.12 google.golang.org/protobuf v1.28.0 @@ -52,12 +55,13 @@ require ( github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v0.4.0 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/gofrs/uuid v4.2.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.4.1 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/google/go-cmp v0.5.8 // indirect + github.com/google/go-cmp v0.5.9 // indirect github.com/google/gofuzz v1.1.0 // indirect github.com/googleapis/gax-go/v2 v2.3.0 // indirect github.com/googleapis/go-type-adapters v1.0.0 // indirect @@ -81,14 +85,15 @@ require ( github.com/spf13/afero v1.8.2 // indirect github.com/spf13/cast v1.4.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/stretchr/objx v0.3.0 // indirect + github.com/stretchr/objx v0.4.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect go.opencensus.io v0.23.0 // indirect + go.opentelemetry.io/otel/trace v1.11.1 // indirect golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f // indirect golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect - golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect google.golang.org/api v0.76.0 // indirect @@ -98,7 +103,7 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.66.4 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/klog/v2 v2.5.0 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.0.3 // indirect ) diff --git a/go.sum b/go.sum index b235518..638ec7f 100644 --- a/go.sum +++ b/go.sum @@ -182,8 +182,12 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= -github.com/go-logr/logr v0.4.0 h1:K7/B1jt6fIBQVd4Owv2MqGQClcgf0R266+7C/QjRcLc= github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= @@ -254,8 +258,8 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -441,16 +445,17 @@ github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUs github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/objx v0.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As= -github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 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/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -466,6 +471,14 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opentelemetry.io/otel v1.11.1 h1:4WLLAmcfkmDk2ukNXJyq3/kiz/3UzCaYq6PskJsaou4= +go.opentelemetry.io/otel v1.11.1/go.mod h1:1nNhXBbWSD0nsL38H6btgnFN2k4i0sNLHNNMZMSbUGE= +go.opentelemetry.io/otel/exporters/jaeger v1.11.1 h1:F9Io8lqWdGyIbY3/SOGki34LX/l+7OL0gXNxjqwcbuQ= +go.opentelemetry.io/otel/exporters/jaeger v1.11.1/go.mod h1:lRa2w3bQ4R4QN6zYsDgy7tEezgoKEu7Ow2g35Y75+KI= +go.opentelemetry.io/otel/sdk v1.11.1 h1:F7KmQgoHljhUuJyA+9BiU+EkJfyX5nVVF4wyzWZpKxs= +go.opentelemetry.io/otel/sdk v1.11.1/go.mod h1:/l3FE4SupHJ12TduVjUkZtlfFqDCQJlOlithYrdktys= +go.opentelemetry.io/otel/trace v1.11.1 h1:ofxdnzsNrGBYXbP7t7zpUK281+go5rF7dvdIZXF8gdQ= +go.opentelemetry.io/otel/trace v1.11.1/go.mod h1:f/Q9G7vzk5u91PhbmKbg1Qn0rzH1LJ4vbPHFGkTPtOk= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -670,8 +683,8 @@ golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 h1:v6hYoSR9T5oet+pMXwUWkbiVqx/63mlHjefrHmxwfeY= -golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -945,8 +958,8 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/gorm v1.22.4 h1:8aPcyEJhY0MAt8aY6Dc524Pn+pO29K+ydu+e/cXSpQM= gorm.io/gorm v1.22.4/go.mod h1:1aeVC+pe9ZmvKZban/gW4QPra7PRoTEssyc922qCAkk= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/storage/cached_rawstore.go b/storage/cached_rawstore.go index f380828..bfffff1 100644 --- a/storage/cached_rawstore.go +++ b/storage/cached_rawstore.go @@ -8,6 +8,7 @@ import ( "time" "github.com/flyteorg/flytestdlib/errors" + "github.com/flyteorg/flytestdlib/telemetryutils" "github.com/coocood/freecache" "github.com/prometheus/client_golang/prometheus" @@ -49,6 +50,9 @@ func (s *cachedRawStore) Head(ctx context.Context, reference DataReference) (Met // ReadRaw retrieves a byte array from the Blob store or an error func (s *cachedRawStore) ReadRaw(ctx context.Context, reference DataReference) (io.ReadCloser, error) { + ctx, span := telemetryutils.NewSpan(ctx, "github.com/flyteorg/flytestdlib", "ReadRaw") + defer span.End() + key := []byte(reference) if oRaw, err := s.cache.Get(key); err == nil { // Found, Cache hit @@ -84,6 +88,9 @@ func (s *cachedRawStore) ReadRaw(ctx context.Context, reference DataReference) ( // WriteRaw stores a raw byte array. func (s *cachedRawStore) WriteRaw(ctx context.Context, reference DataReference, size int64, opts Options, raw io.Reader) error { + ctx, span := telemetryutils.NewSpan(ctx, "github.com/flyteorg/flytestdlib", "WriteRaw") + defer span.End() + var buf bytes.Buffer teeReader := io.TeeReader(raw, &buf) err := s.RawStore.WriteRaw(ctx, reference, size, opts, teeReader) diff --git a/storage/protobuf_store.go b/storage/protobuf_store.go index 1eca509..b9df0dd 100644 --- a/storage/protobuf_store.go +++ b/storage/protobuf_store.go @@ -13,6 +13,7 @@ import ( "github.com/flyteorg/flytestdlib/ioutils" "github.com/flyteorg/flytestdlib/logger" "github.com/flyteorg/flytestdlib/promutils" + "github.com/flyteorg/flytestdlib/telemetryutils" ) type protoMetrics struct { @@ -32,6 +33,9 @@ type DefaultProtobufStore struct { } func (s DefaultProtobufStore) ReadProtobuf(ctx context.Context, reference DataReference, msg proto.Message) error { + ctx, span := telemetryutils.NewSpan(ctx, "github.com/flyteorg/flytestdlib", "ReadProtobuf") + defer span.End() + rc, err := s.ReadRaw(ctx, reference) if err != nil && !IsFailedWriteToCache(err) { logger.Errorf(ctx, "Failed to read from the raw store [%s] Error: %v", reference, err) @@ -63,6 +67,9 @@ func (s DefaultProtobufStore) ReadProtobuf(ctx context.Context, reference DataRe } func (s DefaultProtobufStore) WriteProtobuf(ctx context.Context, reference DataReference, opts Options, msg proto.Message) error { + ctx, span := telemetryutils.NewSpan(ctx, "github.com/flyteorg/flytestdlib", "WriteProtobuf") + defer span.End() + t := s.metrics.MarshalTime.Start() raw, err := proto.Marshal(msg) t.Stop() diff --git a/telemetryutils/config.go b/telemetryutils/config.go new file mode 100644 index 0000000..d2519a8 --- /dev/null +++ b/telemetryutils/config.go @@ -0,0 +1,52 @@ +package telemetryutils + +import ( + "context" + + "github.com/flyteorg/flytestdlib/config" + "github.com/flyteorg/flytestdlib/logger" +) + +//go:generate pflags Config --default-var=defaultConfig + +type Type = string + +const configSectionKey = "telemetry" + +var ( + ConfigSection = config.MustRegisterSection(configSectionKey, defaultConfig) + defaultConfig = &Config{ + FileConfig: FileConfig{ + Enabled: false, + Filename: "/tmp/trace.txt", + }, + JaegerConfig: JaegerConfig{ + Enabled: false, + Endpoint: "http://localhost:14268/api/traces", + }, + } +) + +type Config struct { + FileConfig FileConfig `json:"file", pflag:",TODO"` + JaegerConfig JaegerConfig `json:"jaeger", pflag:",TODO"` +} + +type FileConfig struct { + Enabled bool `json:"enabled" pflag:",TODO"` + Filename string `json:"filename" pflag:",TODO"` +} + +type JaegerConfig struct { + Enabled bool `json:"enabled" pflag:",TODO"` + Endpoint string `json:"endpoint" pflag:",TODO"` +} + +func GetConfig() *Config { + if c, ok := ConfigSection.GetConfig().(*Config); ok { + return c + } + + logger.Warnf(context.TODO(), "Failed to retrieve config section [%v].", configSectionKey) + return nil +} diff --git a/telemetryutils/factory.go b/telemetryutils/factory.go new file mode 100644 index 0000000..06fff93 --- /dev/null +++ b/telemetryutils/factory.go @@ -0,0 +1,74 @@ +package telemetryutils + +import ( + "os" + + "github.com/flyteorg/flytestdlib/version" + + //"go.opentelemetry.io/otel" + //"go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" + "go.opentelemetry.io/otel/exporters/jaeger" + "go.opentelemetry.io/otel/sdk/resource" + "go.opentelemetry.io/otel/sdk/trace" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" +) + +func NewTracerProvider(appName string, config *Config) (*trace.TracerProvider, error) { + if config == nil { + return nil, nil + } + + var opts []trace.TracerProviderOption + if config.FileConfig.Enabled { + // configure file exporter + f, err := os.Create(config.FileConfig.Filename) + if err != nil { + return nil, err + } + + exporter, err := stdouttrace.New( + stdouttrace.WithWriter(f), + stdouttrace.WithPrettyPrint(), + ) + if err != nil { + return nil, err + } + + opts = append(opts, trace.WithBatcher(exporter)) + } + + if config.JaegerConfig.Enabled { + // configure jaeger exporter + exporter, err := jaeger.New( + jaeger.WithCollectorEndpoint( + jaeger.WithEndpoint(config.JaegerConfig.Endpoint), + ), + ) + if err != nil { + return nil, err + } + + opts = append(opts, trace.WithBatcher(exporter)) + } + + // if no exporters are enabled then we return a nil TracerProvider + if len(opts) == 0 { + return nil, nil + } + + telemetryResource, err := resource.Merge( + resource.Default(), + resource.NewWithAttributes( + semconv.SchemaURL, + semconv.ServiceNameKey.String(appName), + semconv.ServiceVersionKey.String(version.Version), + ), + ) + if err != nil { + return nil, err + } + + opts = append(opts, trace.WithResource(telemetryResource)) + return trace.NewTracerProvider(opts...), nil +} diff --git a/telemetryutils/utils.go b/telemetryutils/utils.go new file mode 100644 index 0000000..b167e07 --- /dev/null +++ b/telemetryutils/utils.go @@ -0,0 +1,22 @@ +package telemetryutils + +import ( + "context" + + "github.com/flyteorg/flytestdlib/contextutils" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" +) + +func NewSpan(ctx context.Context, tracerName string, spanName string) (context.Context, trace.Span) { + var attributes []attribute.KeyValue + for key, value := range contextutils.GetLogFields(ctx) { + if value, ok := value.(string); ok { + attributes = append(attributes, attribute.String(key, value)) + } + } + + return otel.Tracer(tracerName).Start(ctx, spanName, trace.WithAttributes(attributes...)) +} From 243fb220de5cd61b38f5fbc05ab7367b27e118e0 Mon Sep 17 00:00:00 2001 From: Dan Rammer Date: Wed, 2 Nov 2022 10:41:02 -0500 Subject: [PATCH 2/8] updated go.mod Signed-off-by: Dan Rammer --- go.mod | 3 ++- go.sum | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 5e03e5a..92bd90d 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,9 @@ require ( github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/exporters/jaeger v1.11.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.1 go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/trace v1.11.1 golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 golang.org/x/tools v0.1.12 google.golang.org/protobuf v1.28.0 @@ -88,7 +90,6 @@ require ( github.com/stretchr/objx v0.4.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect go.opencensus.io v0.23.0 // indirect - go.opentelemetry.io/otel/trace v1.11.1 // indirect golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f // indirect golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect diff --git a/go.sum b/go.sum index 638ec7f..42fbb6e 100644 --- a/go.sum +++ b/go.sum @@ -475,6 +475,8 @@ go.opentelemetry.io/otel v1.11.1 h1:4WLLAmcfkmDk2ukNXJyq3/kiz/3UzCaYq6PskJsaou4= go.opentelemetry.io/otel v1.11.1/go.mod h1:1nNhXBbWSD0nsL38H6btgnFN2k4i0sNLHNNMZMSbUGE= go.opentelemetry.io/otel/exporters/jaeger v1.11.1 h1:F9Io8lqWdGyIbY3/SOGki34LX/l+7OL0gXNxjqwcbuQ= go.opentelemetry.io/otel/exporters/jaeger v1.11.1/go.mod h1:lRa2w3bQ4R4QN6zYsDgy7tEezgoKEu7Ow2g35Y75+KI= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.1 h1:3Yvzs7lgOw8MmbxmLRsQGwYdCubFmUHSooKaEhQunFQ= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.1/go.mod h1:pyHDt0YlyuENkD2VwHsiRDf+5DfI3EH7pfhUYW6sQUE= go.opentelemetry.io/otel/sdk v1.11.1 h1:F7KmQgoHljhUuJyA+9BiU+EkJfyX5nVVF4wyzWZpKxs= go.opentelemetry.io/otel/sdk v1.11.1/go.mod h1:/l3FE4SupHJ12TduVjUkZtlfFqDCQJlOlithYrdktys= go.opentelemetry.io/otel/trace v1.11.1 h1:ofxdnzsNrGBYXbP7t7zpUK281+go5rF7dvdIZXF8gdQ= From bb0c2e02906ec8e3a181bd961d01f4e4494b5126 Mon Sep 17 00:00:00 2001 From: Dan Rammer Date: Tue, 8 Nov 2022 10:05:06 -0600 Subject: [PATCH 3/8] updated to new span Signed-off-by: Dan Rammer --- storage/cached_rawstore.go | 4 ++-- storage/protobuf_store.go | 4 ++-- telemetryutils/factory.go | 26 ++++++++++++++++---------- telemetryutils/utils.go | 25 +++++++++++++++++++++++-- 4 files changed, 43 insertions(+), 16 deletions(-) diff --git a/storage/cached_rawstore.go b/storage/cached_rawstore.go index bfffff1..782cda9 100644 --- a/storage/cached_rawstore.go +++ b/storage/cached_rawstore.go @@ -50,7 +50,7 @@ func (s *cachedRawStore) Head(ctx context.Context, reference DataReference) (Met // ReadRaw retrieves a byte array from the Blob store or an error func (s *cachedRawStore) ReadRaw(ctx context.Context, reference DataReference) (io.ReadCloser, error) { - ctx, span := telemetryutils.NewSpan(ctx, "github.com/flyteorg/flytestdlib", "ReadRaw") + ctx, span := telemetryutils.NewSpan(ctx, "blobstore", "ReadRaw") defer span.End() key := []byte(reference) @@ -88,7 +88,7 @@ func (s *cachedRawStore) ReadRaw(ctx context.Context, reference DataReference) ( // WriteRaw stores a raw byte array. func (s *cachedRawStore) WriteRaw(ctx context.Context, reference DataReference, size int64, opts Options, raw io.Reader) error { - ctx, span := telemetryutils.NewSpan(ctx, "github.com/flyteorg/flytestdlib", "WriteRaw") + ctx, span := telemetryutils.NewSpan(ctx, "blobstore", "WriteRaw") defer span.End() var buf bytes.Buffer diff --git a/storage/protobuf_store.go b/storage/protobuf_store.go index b9df0dd..178cc6e 100644 --- a/storage/protobuf_store.go +++ b/storage/protobuf_store.go @@ -33,7 +33,7 @@ type DefaultProtobufStore struct { } func (s DefaultProtobufStore) ReadProtobuf(ctx context.Context, reference DataReference, msg proto.Message) error { - ctx, span := telemetryutils.NewSpan(ctx, "github.com/flyteorg/flytestdlib", "ReadProtobuf") + ctx, span := telemetryutils.NewSpan(ctx, "blobstore", "ReadProtobuf") defer span.End() rc, err := s.ReadRaw(ctx, reference) @@ -67,7 +67,7 @@ func (s DefaultProtobufStore) ReadProtobuf(ctx context.Context, reference DataRe } func (s DefaultProtobufStore) WriteProtobuf(ctx context.Context, reference DataReference, opts Options, msg proto.Message) error { - ctx, span := telemetryutils.NewSpan(ctx, "github.com/flyteorg/flytestdlib", "WriteProtobuf") + ctx, span := telemetryutils.NewSpan(ctx, "blobstore", "WriteProtobuf") defer span.End() t := s.metrics.MarshalTime.Start() diff --git a/telemetryutils/factory.go b/telemetryutils/factory.go index 06fff93..e4b4fba 100644 --- a/telemetryutils/factory.go +++ b/telemetryutils/factory.go @@ -11,12 +11,16 @@ import ( "go.opentelemetry.io/otel/exporters/jaeger" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/trace" + rawtrace "go.opentelemetry.io/otel/trace" semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) -func NewTracerProvider(appName string, config *Config) (*trace.TracerProvider, error) { +var tracerProviders = make(map[string]*trace.TracerProvider) +var noopTracerProvider = rawtrace.NewNoopTracerProvider() + +func RegisterTracerProvider(serviceName string, config *Config) error { if config == nil { - return nil, nil + return nil } var opts []trace.TracerProviderOption @@ -24,7 +28,7 @@ func NewTracerProvider(appName string, config *Config) (*trace.TracerProvider, e // configure file exporter f, err := os.Create(config.FileConfig.Filename) if err != nil { - return nil, err + return err } exporter, err := stdouttrace.New( @@ -32,7 +36,7 @@ func NewTracerProvider(appName string, config *Config) (*trace.TracerProvider, e stdouttrace.WithPrettyPrint(), ) if err != nil { - return nil, err + return err } opts = append(opts, trace.WithBatcher(exporter)) @@ -46,29 +50,31 @@ func NewTracerProvider(appName string, config *Config) (*trace.TracerProvider, e ), ) if err != nil { - return nil, err + return err } opts = append(opts, trace.WithBatcher(exporter)) } - // if no exporters are enabled then we return a nil TracerProvider + // if no exporters are enabled then we can return if len(opts) == 0 { - return nil, nil + return nil } telemetryResource, err := resource.Merge( resource.Default(), resource.NewWithAttributes( semconv.SchemaURL, - semconv.ServiceNameKey.String(appName), + semconv.ServiceNameKey.String(serviceName), semconv.ServiceVersionKey.String(version.Version), ), ) if err != nil { - return nil, err + return err } opts = append(opts, trace.WithResource(telemetryResource)) - return trace.NewTracerProvider(opts...), nil + tracerProviders[serviceName] = trace.NewTracerProvider(opts...) + + return nil } diff --git a/telemetryutils/utils.go b/telemetryutils/utils.go index b167e07..4ad92b9 100644 --- a/telemetryutils/utils.go +++ b/telemetryutils/utils.go @@ -5,12 +5,12 @@ import ( "github.com/flyteorg/flytestdlib/contextutils" - "go.opentelemetry.io/otel" + //"go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" ) -func NewSpan(ctx context.Context, tracerName string, spanName string) (context.Context, trace.Span) { +/*func NewSpan(ctx context.Context, tracerName string, spanName string) (context.Context, trace.Span) { var attributes []attribute.KeyValue for key, value := range contextutils.GetLogFields(ctx) { if value, ok := value.(string); ok { @@ -19,4 +19,25 @@ func NewSpan(ctx context.Context, tracerName string, spanName string) (context.C } return otel.Tracer(tracerName).Start(ctx, spanName, trace.WithAttributes(attributes...)) +}*/ + +func NewSpan(ctx context.Context, serviceName string, spanName string) (context.Context, trace.Span) { + // TODO @hamersaw - can check ctx.IDK to see if tracing is enabled on + // if not -> use a NoopTracerProvider + var tracerProvider trace.TracerProvider + if t, ok := tracerProviders[serviceName]; ok { + tracerProvider = t + } else { + // TODO @hamersaw - add warning "tracerProvider 'foo' not registered" + tracerProvider = noopTracerProvider + } + + var attributes []attribute.KeyValue + for key, value := range contextutils.GetLogFields(ctx) { + if value, ok := value.(string); ok { + attributes = append(attributes, attribute.String(key, value)) + } + } + + return tracerProvider.Tracer("default").Start(ctx, spanName, trace.WithAttributes(attributes...)) } From 4f2c320801e67162065ec137bbc1c39595e9bc6d Mon Sep 17 00:00:00 2001 From: Dan Rammer Date: Thu, 10 Nov 2022 02:27:29 -0600 Subject: [PATCH 4/8] added k8s wrapper Signed-off-by: Dan Rammer --- go.mod | 32 ++++++--- go.sum | 135 +++++++++++++++++++++++-------------- storage/cached_rawstore.go | 4 +- storage/protobuf_store.go | 4 +- telemetryutils/k8s.go | 100 +++++++++++++++++++++++++++ 5 files changed, 214 insertions(+), 61 deletions(-) create mode 100644 telemetryutils/k8s.go diff --git a/go.mod b/go.mod index 92bd90d..e859383 100644 --- a/go.mod +++ b/go.mod @@ -29,13 +29,14 @@ require ( go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.1 go.opentelemetry.io/otel/sdk v1.11.1 go.opentelemetry.io/otel/trace v1.11.1 - golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 + golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 golang.org/x/tools v0.1.12 google.golang.org/protobuf v1.28.0 gorm.io/gorm v1.22.4 - k8s.io/api v0.20.2 - k8s.io/apimachinery v0.20.2 - k8s.io/client-go v0.0.0-20210217172142-7279fc64d847 + k8s.io/api v0.24.0 + k8s.io/apimachinery v0.24.0 + k8s.io/client-go v0.24.0 + sigs.k8s.io/controller-runtime v0.12.1 ) require ( @@ -53,16 +54,24 @@ require ( github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect github.com/Azure/go-autorest/logger v0.2.1 // indirect github.com/Azure/go-autorest/tracing v0.6.0 // indirect + github.com/PuerkitoBio/purell v1.1.1 // indirect + github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/emicklei/go-restful v2.9.5+incompatible // indirect + github.com/evanphx/json-patch v4.12.0+incompatible // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-openapi/jsonpointer v0.19.5 // indirect + github.com/go-openapi/jsonreference v0.19.5 // indirect + github.com/go-openapi/swag v0.19.14 // indirect github.com/gofrs/uuid v4.2.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.4.1 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/google/gnostic v0.5.7-v3refs // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/gofuzz v1.1.0 // indirect github.com/googleapis/gax-go/v2 v2.3.0 // indirect @@ -70,13 +79,15 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/kr/text v0.2.0 // indirect + github.com/mailru/easyjson v0.7.6 // indirect github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-isatty v0.0.14 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/ncw/swift v1.0.53 // indirect github.com/pelletier/go-toml v1.9.4 // indirect github.com/pelletier/go-toml/v2 v2.0.0-beta.8 // indirect @@ -95,6 +106,7 @@ require ( golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect google.golang.org/api v0.76.0 // indirect @@ -105,6 +117,10 @@ require ( gopkg.in/ini.v1 v1.66.4 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/klog/v2 v2.5.0 // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.0.3 // indirect + k8s.io/klog/v2 v2.60.1 // indirect + k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect + k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect + sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect + sigs.k8s.io/yaml v1.3.0 // indirect ) diff --git a/go.sum b/go.sum index 42fbb6e..602b1e0 100644 --- a/go.sum +++ b/go.sum @@ -71,10 +71,10 @@ github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.4.0 h1:0nJeKDmB7a1a8RDMj github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.4.0/go.mod h1:mbwxKc/fW+IkF0GG591MuXw0KuEQBDkeRoZ9vmVJPxg= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= -github.com/Azure/go-autorest/autorest v0.11.12/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw= +github.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA= github.com/Azure/go-autorest/autorest v0.11.27 h1:F3R3q42aWytozkV8ihzcgMO4OA4cuqr3bNlsEuF6//A= github.com/Azure/go-autorest/autorest v0.11.27/go.mod h1:7l8ybrIdUmGqZMTD0sRtAr8NvbHjfofbf8RSP2q7w7U= -github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= +github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M= github.com/Azure/go-autorest/autorest/adal v0.9.18 h1:kLnPsRjzZZUF3K5REu/Kc+qMQrvuza2bwSnNdhmzLfQ= github.com/Azure/go-autorest/autorest/adal v0.9.18/go.mod h1:XVVeme+LZwABT8K5Lc3hA4nAe8LDBVle26gTrguhhPQ= github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw= @@ -83,7 +83,6 @@ github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935 github.com/Azure/go-autorest/autorest/mocks v0.4.2 h1:PGN4EDXnuQbojHbU0UWoNvmu9AGVwYHG9/fkDYhtAfw= github.com/Azure/go-autorest/autorest/mocks v0.4.2/go.mod h1:Vy7OitM9Kei0i1Oj+LvyAWMXJHeKH1MVlzFugfVrmyU= github.com/Azure/go-autorest/autorest/to v0.4.0 h1:oXVqrxakqqV1UZdSazDOPOLvOIz+XA683u8EctwboHk= -github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+ZtXWSmf4Tg= github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= @@ -94,7 +93,9 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -102,6 +103,7 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/aws/aws-sdk-go v1.44.2 h1:5VBk5r06bgxgRKVaUtm1/4NT/rtrnH2E4cnAYv5zgQc= github.com/aws/aws-sdk-go v1.44.2/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= @@ -140,10 +142,11 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= -github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= +github.com/emicklei/go-restful v2.9.5+incompatible h1:spTtZBk5DYEvbxMVutUuTyh1Ao2r4iyvLdACqsl/Ljk= +github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 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= @@ -156,7 +159,8 @@ github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go. github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ernesto-jimenez/gogen v0.0.0-20180125220232-d7d4131e6607 h1:cTavhURetDkezJCvxFggiyLeP40Mrk/TtVg2+ycw1Es= github.com/ernesto-jimenez/gogen v0.0.0-20180125220232-d7d4131e6607/go.mod h1:Cg4fM0vhYWOZdgM7RIOSTRNIc8/VT7CXClC3Ni86lu4= -github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= +github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= @@ -164,11 +168,12 @@ github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4 github.com/flyteorg/stow v0.3.6 h1:jt50ciM14qhKBaIrB+ppXXY+SXB59FNREFgTJqCyqIk= github.com/flyteorg/stow v0.3.6/go.mod h1:5dfBitPM004dwaZdoVylVjxFT4GWAgI0ghAndhNUzCo= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= +github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= -github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -182,26 +187,28 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= -github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= +github.com/go-logr/zapr v1.2.0 h1:n4JnPI1T3Qq1SFEi/F8rwLrZERp2bso19PJZDB9dayk= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= +github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= -github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= -github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/jsonreference v0.19.5 h1:1WJP/wi4OjB4iV8KVbH73rQaoialJrqv8gitZLxGLtM= +github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.14 h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5Fng= +github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.7 h1:/VSMRlnY/JSyqxQUzQLKVMAskpY/NZKFA5j2P+0pP2M= github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8= github.com/gofrs/uuid v4.2.0+incompatible h1:yyYWMnhkhrKwwr8gAOcOCYxOOscHgDS9yZgBrnJfGa0= github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= @@ -245,6 +252,9 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= +github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54= +github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= 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/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -286,7 +296,6 @@ github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -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= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= @@ -296,10 +305,10 @@ github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0 github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= github.com/googleapis/gax-go/v2 v2.3.0 h1:nRJtk3y8Fm770D42QV6T90ZnvFZyk7agSo3Q+Z9p3WI= github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= -github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= github.com/googleapis/go-type-adapters v1.0.0 h1:9XdMn+d/G57qq1s8dNc5IesGCXHf6V2HZ2JwRxfA2tA= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= @@ -313,6 +322,7 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO 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/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= @@ -322,6 +332,8 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -332,7 +344,6 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -340,10 +351,8 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxv github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= @@ -352,14 +361,17 @@ github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamh github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= +github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= @@ -373,16 +385,26 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/ncw/swift v1.0.53 h1:luHjjTNtekIEvHg5KdAFIBaH7bWfNkefwFnpDffSIks= github.com/ncw/swift v1.0.53/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.0-beta.8 h1:dy81yyLYJDwMTifq24Oi/IslOslRrDSb3jwDggjz3Z0= @@ -437,14 +459,13 @@ github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= -github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.11.0 h1:7OX/1FS6n7jHD1zGrZTM7WtY13ZELRyosK4k93oPr44= github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUsX7Zk= +github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -482,11 +503,13 @@ go.opentelemetry.io/otel/sdk v1.11.1/go.mod h1:/l3FE4SupHJ12TduVjUkZtlfFqDCQJlOl go.opentelemetry.io/otel/trace v1.11.1 h1:ofxdnzsNrGBYXbP7t7zpUK281+go5rF7dvdIZXF8gdQ= go.opentelemetry.io/otel/trace v1.11.1/go.mod h1:f/Q9G7vzk5u91PhbmKbg1Qn0rzH1LJ4vbPHFGkTPtOk= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= +go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= +go.uber.org/zap v1.19.1 h1:ue41HOKd1vGURxrmeKIgELGb3jPW9DMUDGtsinblHwI= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -494,6 +517,7 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -559,6 +583,7 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -624,12 +649,13 @@ golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -645,13 +671,13 @@ golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 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-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -688,6 +714,7 @@ golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -702,11 +729,9 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 h1:Hir2P/De0WpUhtrKGGjvSb2YxUgyZ7EFOSLIcSSpiwE= -golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44= +golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -716,7 +741,6 @@ golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -741,6 +765,7 @@ golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjs golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -769,6 +794,7 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gomodules.xyz/jsonpatch/v2 v2.2.0 h1:4pT439QV83L+G9FkcCriY6EkpcK6r6bK+A5FBUMI7qY= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -846,6 +872,7 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -941,14 +968,16 @@ google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= 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= @@ -960,6 +989,8 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/gorm v1.22.4 h1:8aPcyEJhY0MAt8aY6Dc524Pn+pO29K+ydu+e/cXSpQM= @@ -971,27 +1002,33 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.0.0-20210217171935-8e2decd92398/go.mod h1:60tmSUpHxGPFerNHbo/ayI2lKxvtrhbxFyXuEIWJd78= -k8s.io/api v0.20.2 h1:y/HR22XDZY3pniu9hIFDLpUCPq2w5eQ6aV/VFQ7uJMw= -k8s.io/api v0.20.2/go.mod h1:d7n6Ehyzx+S+cE3VhTGfVNNqtGc/oL9DCdYYahlurV8= -k8s.io/apimachinery v0.0.0-20210217011835-527a61b4dffe/go.mod h1:Z7ps/g0rjlTeMstYrMOUttJfT2Gg34DEaG/f2PYLCWY= -k8s.io/apimachinery v0.20.2 h1:hFx6Sbt1oG0n6DZ+g4bFt5f6BoMkOjKWsQFu077M3Vg= -k8s.io/apimachinery v0.20.2/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= -k8s.io/client-go v0.0.0-20210217172142-7279fc64d847 h1:d+LBRNY3c/KGp7lDblRlUJkayx4Vla7WUTIazoGMdYo= -k8s.io/client-go v0.0.0-20210217172142-7279fc64d847/go.mod h1:q0EaghmVye2uui19vxSZ2NG6ssgUWgjudO6vrwXneSI= -k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/api v0.24.0 h1:J0hann2hfxWr1hinZIDefw7Q96wmCBx6SSB8IY0MdDg= +k8s.io/api v0.24.0/go.mod h1:5Jl90IUrJHUJYEMANRURMiVvJ0g7Ax7r3R1bqO8zx8I= +k8s.io/apiextensions-apiserver v0.24.0 h1:JfgFqbA8gKJ/uDT++feAqk9jBIwNnL9YGdQvaI9DLtY= +k8s.io/apimachinery v0.24.0 h1:ydFCyC/DjCvFCHK5OPMKBlxayQytB8pxy8YQInd5UyQ= +k8s.io/apimachinery v0.24.0/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM= +k8s.io/client-go v0.24.0 h1:lbE4aB1gTHvYFSwm6eD3OF14NhFDKCejlnsGYlSJe5U= +k8s.io/client-go v0.24.0/go.mod h1:VFPQET+cAFpYxh6Bq6f4xyMY80G6jKKktU6G0m00VDw= +k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= -k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= -k8s.io/klog/v2 v2.5.0 h1:8mOnjf1RmUPW6KRqQCfYSZq/K20Unmp3IhuZUhxl8KI= -k8s.io/klog/v2 v2.5.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= -k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= -k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= +k8s.io/klog/v2 v2.60.1 h1:VW25q3bZx9uE3vvdL6M8ezOX79vA2Aq1nEWLqNQclHc= +k8s.io/klog/v2 v2.60.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 h1:Gii5eqf+GmIEwGNKQYQClCayuJCe2/4fZUvF7VG99sU= +k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42/go.mod h1:Z/45zLw8lUo4wdiUkI+v/ImEGAvu3WatcZl3lPMR4Rk= +k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 h1:HNSDgDCrr/6Ly3WEGKZftiE7IY19Vz2GdbOCyI4qqhc= +k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +sigs.k8s.io/controller-runtime v0.12.1 h1:4BJY01xe9zKQti8oRjj/NeHKRXthf1YkYJAgLONFFoI= +sigs.k8s.io/controller-runtime v0.12.1/go.mod h1:BKhxlA4l7FPK4AQcsuL4X6vZeWnKDXez/vp1Y8dxTU0= +sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 h1:kDi4JBNAsJWfz1aEXhO8Jg87JJaPNLh5tIzYHgStQ9Y= +sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2/go.mod h1:B+TnT182UBxE84DiCz4CVE26eOSDAeYCpfDnC2kdKMY= sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= -sigs.k8s.io/structured-merge-diff/v4 v4.0.3 h1:4oyYo8NREp49LBBhKxEqCulFjg26rawYKrnCmg+Sr6c= -sigs.k8s.io/structured-merge-diff/v4 v4.0.3/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= +sigs.k8s.io/structured-merge-diff/v4 v4.2.1 h1:bKCqE9GvQ5tiVHn5rfn1r+yao3aLQEaLzkkmAkf+A6Y= +sigs.k8s.io/structured-merge-diff/v4 v4.2.1/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= +sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/storage/cached_rawstore.go b/storage/cached_rawstore.go index 782cda9..1bfdc06 100644 --- a/storage/cached_rawstore.go +++ b/storage/cached_rawstore.go @@ -50,7 +50,7 @@ func (s *cachedRawStore) Head(ctx context.Context, reference DataReference) (Met // ReadRaw retrieves a byte array from the Blob store or an error func (s *cachedRawStore) ReadRaw(ctx context.Context, reference DataReference) (io.ReadCloser, error) { - ctx, span := telemetryutils.NewSpan(ctx, "blobstore", "ReadRaw") + ctx, span := telemetryutils.NewSpan(ctx, "blobstore", "cachedRawStore.ReadRaw") defer span.End() key := []byte(reference) @@ -88,7 +88,7 @@ func (s *cachedRawStore) ReadRaw(ctx context.Context, reference DataReference) ( // WriteRaw stores a raw byte array. func (s *cachedRawStore) WriteRaw(ctx context.Context, reference DataReference, size int64, opts Options, raw io.Reader) error { - ctx, span := telemetryutils.NewSpan(ctx, "blobstore", "WriteRaw") + ctx, span := telemetryutils.NewSpan(ctx, "blobstore", "cachedRawStore.WriteRaw") defer span.End() var buf bytes.Buffer diff --git a/storage/protobuf_store.go b/storage/protobuf_store.go index 178cc6e..adcfba9 100644 --- a/storage/protobuf_store.go +++ b/storage/protobuf_store.go @@ -33,7 +33,7 @@ type DefaultProtobufStore struct { } func (s DefaultProtobufStore) ReadProtobuf(ctx context.Context, reference DataReference, msg proto.Message) error { - ctx, span := telemetryutils.NewSpan(ctx, "blobstore", "ReadProtobuf") + ctx, span := telemetryutils.NewSpan(ctx, "blobstore", "DefaultProtobufStore.ReadProtobuf") defer span.End() rc, err := s.ReadRaw(ctx, reference) @@ -67,7 +67,7 @@ func (s DefaultProtobufStore) ReadProtobuf(ctx context.Context, reference DataRe } func (s DefaultProtobufStore) WriteProtobuf(ctx context.Context, reference DataReference, opts Options, msg proto.Message) error { - ctx, span := telemetryutils.NewSpan(ctx, "blobstore", "WriteProtobuf") + ctx, span := telemetryutils.NewSpan(ctx, "blobstore", "DefaultProtobufStore.WriteProtobuf") defer span.End() t := s.metrics.MarshalTime.Start() diff --git a/telemetryutils/k8s.go b/telemetryutils/k8s.go new file mode 100644 index 0000000..aaff0c0 --- /dev/null +++ b/telemetryutils/k8s.go @@ -0,0 +1,100 @@ +package telemetryutils + +import ( + "context" + + "sigs.k8s.io/controller-runtime/pkg/cache" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +type K8sCacheWrapper struct { + cache.Cache +} + +func WrapK8sCache(c cache.Cache) cache.Cache { + return &K8sCacheWrapper{c} +} + +func (c *K8sCacheWrapper) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error { + ctx, span := NewSpan(ctx, "kubernetes", "Cache.Get") + defer span.End() + return c.Cache.Get(ctx, key, obj) +} + +func (c *K8sCacheWrapper) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error { + ctx, span := NewSpan(ctx, "kubernetes", "Cache.List") + defer span.End() + return c.Cache.List(ctx, list, opts...) +} + +type K8sClientWrapper struct { + client.Client + + statusWriter *K8sStatusWriterWrapper +} + +func WrapK8sClient(c client.Client) client.Client { + return &K8sClientWrapper{c, &K8sStatusWriterWrapper{c.Status()}} +} + +func (c *K8sClientWrapper) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error { + ctx, span := NewSpan(ctx, "kubernetes", "Client.Get") + defer span.End() + return c.Client.Get(ctx, key, obj) +} + +func (c *K8sClientWrapper) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error { + ctx, span := NewSpan(ctx, "kubernetes", "Client.List") + defer span.End() + return c.Client.List(ctx, list, opts...) +} + +func (c *K8sClientWrapper) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error { + ctx, span := NewSpan(ctx, "kubernetes", "Client.Create") + defer span.End() + return c.Client.Create(ctx, obj, opts...) +} + +func (c *K8sClientWrapper) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error { + ctx, span := NewSpan(ctx, "kubernetes", "Client.Delete") + defer span.End() + return c.Client.Delete(ctx, obj, opts...) +} + +func (c *K8sClientWrapper) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error { + ctx, span := NewSpan(ctx, "kubernetes", "Client.Update") + defer span.End() + return c.Client.Update(ctx, obj, opts...) +} + +func (c *K8sClientWrapper) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error { + ctx, span := NewSpan(ctx, "kubernetes", "Client.Patch") + defer span.End() + return c.Client.Patch(ctx, obj, patch, opts...) +} + +func (c *K8sClientWrapper) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error { + ctx, span := NewSpan(ctx, "kubernetes", "Client.DeleteAllOf") + defer span.End() + return c.Client.DeleteAllOf(ctx, obj, opts...) +} + +func (c *K8sClientWrapper) Status() client.StatusWriter { + return c.statusWriter +} + +type K8sStatusWriterWrapper struct { + client.StatusWriter +} + +func (s *K8sStatusWriterWrapper) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error { + ctx, span := NewSpan(ctx, "kubernetes", "StatusWriter.Update") + defer span.End() + return s.StatusWriter.Update(ctx, obj, opts...) +} + +func (s *K8sStatusWriterWrapper) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error { + ctx, span := NewSpan(ctx, "kubernetes", "StatusWriter.Patch") + defer span.End() + return s.StatusWriter.Patch(ctx, obj, patch, opts...) +} From 13cc4de59717121d96c4a564ce6ff803cf217e56 Mon Sep 17 00:00:00 2001 From: Dan Rammer Date: Tue, 15 Nov 2022 09:31:13 -0600 Subject: [PATCH 5/8] updated to use new NewSpan definition Signed-off-by: Dan Rammer --- storage/cached_rawstore.go | 4 ++-- storage/protobuf_store.go | 4 ++-- telemetryutils/factory.go | 12 +++++++++++- telemetryutils/k8s.go | 28 +++++++++++++++++----------- telemetryutils/utils.go | 10 ++-------- 5 files changed, 34 insertions(+), 24 deletions(-) diff --git a/storage/cached_rawstore.go b/storage/cached_rawstore.go index 1bfdc06..a462356 100644 --- a/storage/cached_rawstore.go +++ b/storage/cached_rawstore.go @@ -50,7 +50,7 @@ func (s *cachedRawStore) Head(ctx context.Context, reference DataReference) (Met // ReadRaw retrieves a byte array from the Blob store or an error func (s *cachedRawStore) ReadRaw(ctx context.Context, reference DataReference) (io.ReadCloser, error) { - ctx, span := telemetryutils.NewSpan(ctx, "blobstore", "cachedRawStore.ReadRaw") + ctx, span := telemetryutils.NewSpan(ctx, "blobstore-client", "flytestdlib.storage.cachedRawStore/ReadRaw") defer span.End() key := []byte(reference) @@ -88,7 +88,7 @@ func (s *cachedRawStore) ReadRaw(ctx context.Context, reference DataReference) ( // WriteRaw stores a raw byte array. func (s *cachedRawStore) WriteRaw(ctx context.Context, reference DataReference, size int64, opts Options, raw io.Reader) error { - ctx, span := telemetryutils.NewSpan(ctx, "blobstore", "cachedRawStore.WriteRaw") + ctx, span := telemetryutils.NewSpan(ctx, "blobstore-client", "flytestdlib.storage.cachedRawStore/WriteRaw") defer span.End() var buf bytes.Buffer diff --git a/storage/protobuf_store.go b/storage/protobuf_store.go index adcfba9..6847e91 100644 --- a/storage/protobuf_store.go +++ b/storage/protobuf_store.go @@ -33,7 +33,7 @@ type DefaultProtobufStore struct { } func (s DefaultProtobufStore) ReadProtobuf(ctx context.Context, reference DataReference, msg proto.Message) error { - ctx, span := telemetryutils.NewSpan(ctx, "blobstore", "DefaultProtobufStore.ReadProtobuf") + ctx, span := telemetryutils.NewSpan(ctx, "blobstore-client", "flytestdlib.storage.DefaultProtobufStore/ReadProtobuf") defer span.End() rc, err := s.ReadRaw(ctx, reference) @@ -67,7 +67,7 @@ func (s DefaultProtobufStore) ReadProtobuf(ctx context.Context, reference DataRe } func (s DefaultProtobufStore) WriteProtobuf(ctx context.Context, reference DataReference, opts Options, msg proto.Message) error { - ctx, span := telemetryutils.NewSpan(ctx, "blobstore", "DefaultProtobufStore.WriteProtobuf") + ctx, span := telemetryutils.NewSpan(ctx, "blobstore-client", "flytestdlib.storage.DefaultProtobufStore/WriteProtobuf") defer span.End() t := s.metrics.MarshalTime.Start() diff --git a/telemetryutils/factory.go b/telemetryutils/factory.go index e4b4fba..ab412d7 100644 --- a/telemetryutils/factory.go +++ b/telemetryutils/factory.go @@ -74,7 +74,17 @@ func RegisterTracerProvider(serviceName string, config *Config) error { } opts = append(opts, trace.WithResource(telemetryResource)) - tracerProviders[serviceName] = trace.NewTracerProvider(opts...) + tracerProvider := trace.NewTracerProvider(opts...) + tracerProviders[serviceName] = tracerProvider return nil } + +func GetTracerProvider(serviceName string) rawtrace.TracerProvider { + if t, ok := tracerProviders[serviceName]; ok { + return t + } + + // TODO @hamersaw - add warning "tracerProvider 'foo' not registered" + return noopTracerProvider +} diff --git a/telemetryutils/k8s.go b/telemetryutils/k8s.go index aaff0c0..68aed08 100644 --- a/telemetryutils/k8s.go +++ b/telemetryutils/k8s.go @@ -2,11 +2,17 @@ package telemetryutils import ( "context" + "fmt" "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/client" ) +const ( + K8S_SERVICE_NAME = "k8s-client" + PACKAGE = "controller-runtime.pkg.client" +) + type K8sCacheWrapper struct { cache.Cache } @@ -16,13 +22,13 @@ func WrapK8sCache(c cache.Cache) cache.Cache { } func (c *K8sCacheWrapper) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error { - ctx, span := NewSpan(ctx, "kubernetes", "Cache.Get") + ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Cache/Get", PACKAGE)) defer span.End() return c.Cache.Get(ctx, key, obj) } func (c *K8sCacheWrapper) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error { - ctx, span := NewSpan(ctx, "kubernetes", "Cache.List") + ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Cache/List", PACKAGE)) defer span.End() return c.Cache.List(ctx, list, opts...) } @@ -38,43 +44,43 @@ func WrapK8sClient(c client.Client) client.Client { } func (c *K8sClientWrapper) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error { - ctx, span := NewSpan(ctx, "kubernetes", "Client.Get") + ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Client/Get", PACKAGE)) defer span.End() return c.Client.Get(ctx, key, obj) } func (c *K8sClientWrapper) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error { - ctx, span := NewSpan(ctx, "kubernetes", "Client.List") + ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Client/List", PACKAGE)) defer span.End() return c.Client.List(ctx, list, opts...) } func (c *K8sClientWrapper) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error { - ctx, span := NewSpan(ctx, "kubernetes", "Client.Create") + ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Client/Create", PACKAGE)) defer span.End() return c.Client.Create(ctx, obj, opts...) } func (c *K8sClientWrapper) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error { - ctx, span := NewSpan(ctx, "kubernetes", "Client.Delete") + ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Client/Delete", PACKAGE)) defer span.End() return c.Client.Delete(ctx, obj, opts...) } func (c *K8sClientWrapper) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error { - ctx, span := NewSpan(ctx, "kubernetes", "Client.Update") + ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Client/Update", PACKAGE)) defer span.End() return c.Client.Update(ctx, obj, opts...) } func (c *K8sClientWrapper) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error { - ctx, span := NewSpan(ctx, "kubernetes", "Client.Patch") + ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Client/Patch", PACKAGE)) defer span.End() return c.Client.Patch(ctx, obj, patch, opts...) } func (c *K8sClientWrapper) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error { - ctx, span := NewSpan(ctx, "kubernetes", "Client.DeleteAllOf") + ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Client/DeleteAllOf", PACKAGE)) defer span.End() return c.Client.DeleteAllOf(ctx, obj, opts...) } @@ -88,13 +94,13 @@ type K8sStatusWriterWrapper struct { } func (s *K8sStatusWriterWrapper) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error { - ctx, span := NewSpan(ctx, "kubernetes", "StatusWriter.Update") + ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.StatusWriter/Update", PACKAGE)) defer span.End() return s.StatusWriter.Update(ctx, obj, opts...) } func (s *K8sStatusWriterWrapper) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error { - ctx, span := NewSpan(ctx, "kubernetes", "StatusWriter.Patch") + ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.StatusWriter/Patch", PACKAGE)) defer span.End() return s.StatusWriter.Patch(ctx, obj, patch, opts...) } diff --git a/telemetryutils/utils.go b/telemetryutils/utils.go index 4ad92b9..4243180 100644 --- a/telemetryutils/utils.go +++ b/telemetryutils/utils.go @@ -23,14 +23,6 @@ import ( func NewSpan(ctx context.Context, serviceName string, spanName string) (context.Context, trace.Span) { // TODO @hamersaw - can check ctx.IDK to see if tracing is enabled on - // if not -> use a NoopTracerProvider - var tracerProvider trace.TracerProvider - if t, ok := tracerProviders[serviceName]; ok { - tracerProvider = t - } else { - // TODO @hamersaw - add warning "tracerProvider 'foo' not registered" - tracerProvider = noopTracerProvider - } var attributes []attribute.KeyValue for key, value := range contextutils.GetLogFields(ctx) { @@ -39,5 +31,7 @@ func NewSpan(ctx context.Context, serviceName string, spanName string) (context. } } + tracerProvider := GetTracerProvider(serviceName) return tracerProvider.Tracer("default").Start(ctx, spanName, trace.WithAttributes(attributes...)) + // TODO @hamersaw - tracer should be the library name - ex. github.com/flyteorg/flytepropeller } From 2568ebcfb242f1765c65b19dd6d63e40fdcfb7f6 Mon Sep 17 00:00:00 2001 From: Daniel Rammer Date: Thu, 9 Mar 2023 08:50:01 -0600 Subject: [PATCH 6/8] cleaned up Signed-off-by: Daniel Rammer --- cli/pflags/api/namedtype_enumer.go | 1 - storage/cached_rawstore.go | 4 +- storage/protobuf_store.go | 4 +- telemetryutils/config.go | 12 +-- telemetryutils/config_flags.go | 58 ++++++++++ telemetryutils/config_flags_test.go | 158 ++++++++++++++++++++++++++++ telemetryutils/factory.go | 11 +- telemetryutils/k8s.go | 27 +++-- telemetryutils/utils.go | 15 --- 9 files changed, 246 insertions(+), 44 deletions(-) create mode 100755 telemetryutils/config_flags.go create mode 100755 telemetryutils/config_flags_test.go diff --git a/cli/pflags/api/namedtype_enumer.go b/cli/pflags/api/namedtype_enumer.go index 4ea1621..ffceef6 100644 --- a/cli/pflags/api/namedtype_enumer.go +++ b/cli/pflags/api/namedtype_enumer.go @@ -1,6 +1,5 @@ // Code generated by "enumer --type=NamedType --trimprefix=NamedType -json"; DO NOT EDIT. -// package api import ( diff --git a/storage/cached_rawstore.go b/storage/cached_rawstore.go index a462356..0db5e8f 100644 --- a/storage/cached_rawstore.go +++ b/storage/cached_rawstore.go @@ -50,7 +50,7 @@ func (s *cachedRawStore) Head(ctx context.Context, reference DataReference) (Met // ReadRaw retrieves a byte array from the Blob store or an error func (s *cachedRawStore) ReadRaw(ctx context.Context, reference DataReference) (io.ReadCloser, error) { - ctx, span := telemetryutils.NewSpan(ctx, "blobstore-client", "flytestdlib.storage.cachedRawStore/ReadRaw") + ctx, span := telemetryutils.NewSpan(ctx, telemetryutils.BlobstoreClientTracer, "flytestdlib.storage.cachedRawStore/ReadRaw") defer span.End() key := []byte(reference) @@ -88,7 +88,7 @@ func (s *cachedRawStore) ReadRaw(ctx context.Context, reference DataReference) ( // WriteRaw stores a raw byte array. func (s *cachedRawStore) WriteRaw(ctx context.Context, reference DataReference, size int64, opts Options, raw io.Reader) error { - ctx, span := telemetryutils.NewSpan(ctx, "blobstore-client", "flytestdlib.storage.cachedRawStore/WriteRaw") + ctx, span := telemetryutils.NewSpan(ctx, telemetryutils.BlobstoreClientTracer, "flytestdlib.storage.cachedRawStore/WriteRaw") defer span.End() var buf bytes.Buffer diff --git a/storage/protobuf_store.go b/storage/protobuf_store.go index bf73615..b1b3257 100644 --- a/storage/protobuf_store.go +++ b/storage/protobuf_store.go @@ -33,7 +33,7 @@ type DefaultProtobufStore struct { } func (s DefaultProtobufStore) ReadProtobuf(ctx context.Context, reference DataReference, msg proto.Message) error { - ctx, span := telemetryutils.NewSpan(ctx, "blobstore-client", "flytestdlib.storage.DefaultProtobufStore/ReadProtobuf") + ctx, span := telemetryutils.NewSpan(ctx, telemetryutils.BlobstoreClientTracer, "flytestdlib.storage.DefaultProtobufStore/ReadProtobuf") defer span.End() rc, err := s.ReadRaw(ctx, reference) @@ -67,7 +67,7 @@ func (s DefaultProtobufStore) ReadProtobuf(ctx context.Context, reference DataRe } func (s DefaultProtobufStore) WriteProtobuf(ctx context.Context, reference DataReference, opts Options, msg proto.Message) error { - ctx, span := telemetryutils.NewSpan(ctx, "blobstore-client", "flytestdlib.storage.DefaultProtobufStore/WriteProtobuf") + ctx, span := telemetryutils.NewSpan(ctx, telemetryutils.BlobstoreClientTracer, "flytestdlib.storage.DefaultProtobufStore/WriteProtobuf") defer span.End() t := s.metrics.MarshalTime.Start() diff --git a/telemetryutils/config.go b/telemetryutils/config.go index d2519a8..bf617ab 100644 --- a/telemetryutils/config.go +++ b/telemetryutils/config.go @@ -28,18 +28,18 @@ var ( ) type Config struct { - FileConfig FileConfig `json:"file", pflag:",TODO"` - JaegerConfig JaegerConfig `json:"jaeger", pflag:",TODO"` + FileConfig FileConfig `json:"file" pflag:",Configuration for exporting telemetry traces to a file"` + JaegerConfig JaegerConfig `json:"jaeger" pflag:",Configuration for exporting telemetry traces to a jaeger"` } type FileConfig struct { - Enabled bool `json:"enabled" pflag:",TODO"` - Filename string `json:"filename" pflag:",TODO"` + Enabled bool `json:"enabled" pflag:",Set to true to enable the file exporter"` + Filename string `json:"filename" pflag:",Filename to store exported telemetry traces"` } type JaegerConfig struct { - Enabled bool `json:"enabled" pflag:",TODO"` - Endpoint string `json:"endpoint" pflag:",TODO"` + Enabled bool `json:"enabled" pflag:",Set to true to enable the jaeger exporter"` + Endpoint string `json:"endpoint" pflag:",Endpoint for the jaeger telemtry trace ingestor"` } func GetConfig() *Config { diff --git a/telemetryutils/config_flags.go b/telemetryutils/config_flags.go new file mode 100755 index 0000000..985d213 --- /dev/null +++ b/telemetryutils/config_flags.go @@ -0,0 +1,58 @@ +// Code generated by go generate; DO NOT EDIT. +// This file was generated by robots. + +package telemetryutils + +import ( + "encoding/json" + "reflect" + + "fmt" + + "github.com/spf13/pflag" +) + +// If v is a pointer, it will get its element value or the zero value of the element type. +// If v is not a pointer, it will return it as is. +func (Config) elemValueOrNil(v interface{}) interface{} { + if t := reflect.TypeOf(v); t.Kind() == reflect.Ptr { + if reflect.ValueOf(v).IsNil() { + return reflect.Zero(t.Elem()).Interface() + } else { + return reflect.ValueOf(v).Interface() + } + } else if v == nil { + return reflect.Zero(t).Interface() + } + + return v +} + +func (Config) mustJsonMarshal(v interface{}) string { + raw, err := json.Marshal(v) + if err != nil { + panic(err) + } + + return string(raw) +} + +func (Config) mustMarshalJSON(v json.Marshaler) string { + raw, err := v.MarshalJSON() + if err != nil { + panic(err) + } + + return string(raw) +} + +// GetPFlagSet will return strongly types pflags for all fields in Config and its nested types. The format of the +// flags is json-name.json-sub-name... etc. +func (cfg Config) GetPFlagSet(prefix string) *pflag.FlagSet { + cmdFlags := pflag.NewFlagSet("Config", pflag.ExitOnError) + cmdFlags.Bool(fmt.Sprintf("%v%v", prefix, "file.enabled"), defaultConfig.FileConfig.Enabled, "Set to true to enable the file exporter") + cmdFlags.String(fmt.Sprintf("%v%v", prefix, "file.filename"), defaultConfig.FileConfig.Filename, "Filename to store exported telemetry traces") + cmdFlags.Bool(fmt.Sprintf("%v%v", prefix, "jaeger.enabled"), defaultConfig.JaegerConfig.Enabled, "Set to true to enable the jaeger exporter") + cmdFlags.String(fmt.Sprintf("%v%v", prefix, "jaeger.endpoint"), defaultConfig.JaegerConfig.Endpoint, "Endpoint for the jaeger telemtry trace ingestor") + return cmdFlags +} diff --git a/telemetryutils/config_flags_test.go b/telemetryutils/config_flags_test.go new file mode 100755 index 0000000..027901b --- /dev/null +++ b/telemetryutils/config_flags_test.go @@ -0,0 +1,158 @@ +// Code generated by go generate; DO NOT EDIT. +// This file was generated by robots. + +package telemetryutils + +import ( + "encoding/json" + "fmt" + "reflect" + "strings" + "testing" + + "github.com/mitchellh/mapstructure" + "github.com/stretchr/testify/assert" +) + +var dereferencableKindsConfig = map[reflect.Kind]struct{}{ + reflect.Array: {}, reflect.Chan: {}, reflect.Map: {}, reflect.Ptr: {}, reflect.Slice: {}, +} + +// Checks if t is a kind that can be dereferenced to get its underlying type. +func canGetElementConfig(t reflect.Kind) bool { + _, exists := dereferencableKindsConfig[t] + return exists +} + +// This decoder hook tests types for json unmarshaling capability. If implemented, it uses json unmarshal to build the +// object. Otherwise, it'll just pass on the original data. +func jsonUnmarshalerHookConfig(_, to reflect.Type, data interface{}) (interface{}, error) { + unmarshalerType := reflect.TypeOf((*json.Unmarshaler)(nil)).Elem() + if to.Implements(unmarshalerType) || reflect.PtrTo(to).Implements(unmarshalerType) || + (canGetElementConfig(to.Kind()) && to.Elem().Implements(unmarshalerType)) { + + raw, err := json.Marshal(data) + if err != nil { + fmt.Printf("Failed to marshal Data: %v. Error: %v. Skipping jsonUnmarshalHook", data, err) + return data, nil + } + + res := reflect.New(to).Interface() + err = json.Unmarshal(raw, &res) + if err != nil { + fmt.Printf("Failed to umarshal Data: %v. Error: %v. Skipping jsonUnmarshalHook", data, err) + return data, nil + } + + return res, nil + } + + return data, nil +} + +func decode_Config(input, result interface{}) error { + config := &mapstructure.DecoderConfig{ + TagName: "json", + WeaklyTypedInput: true, + Result: result, + DecodeHook: mapstructure.ComposeDecodeHookFunc( + mapstructure.StringToTimeDurationHookFunc(), + mapstructure.StringToSliceHookFunc(","), + jsonUnmarshalerHookConfig, + ), + } + + decoder, err := mapstructure.NewDecoder(config) + if err != nil { + return err + } + + return decoder.Decode(input) +} + +func join_Config(arr interface{}, sep string) string { + listValue := reflect.ValueOf(arr) + strs := make([]string, 0, listValue.Len()) + for i := 0; i < listValue.Len(); i++ { + strs = append(strs, fmt.Sprintf("%v", listValue.Index(i))) + } + + return strings.Join(strs, sep) +} + +func testDecodeJson_Config(t *testing.T, val, result interface{}) { + assert.NoError(t, decode_Config(val, result)) +} + +func testDecodeRaw_Config(t *testing.T, vStringSlice, result interface{}) { + assert.NoError(t, decode_Config(vStringSlice, result)) +} + +func TestConfig_GetPFlagSet(t *testing.T) { + val := Config{} + cmdFlags := val.GetPFlagSet("") + assert.True(t, cmdFlags.HasFlags()) +} + +func TestConfig_SetFlags(t *testing.T) { + actual := Config{} + cmdFlags := actual.GetPFlagSet("") + assert.True(t, cmdFlags.HasFlags()) + + t.Run("Test_file.enabled", func(t *testing.T) { + + t.Run("Override", func(t *testing.T) { + testValue := "1" + + cmdFlags.Set("file.enabled", testValue) + if vBool, err := cmdFlags.GetBool("file.enabled"); err == nil { + testDecodeJson_Config(t, fmt.Sprintf("%v", vBool), &actual.FileConfig.Enabled) + + } else { + assert.FailNow(t, err.Error()) + } + }) + }) + t.Run("Test_file.filename", func(t *testing.T) { + + t.Run("Override", func(t *testing.T) { + testValue := "1" + + cmdFlags.Set("file.filename", testValue) + if vString, err := cmdFlags.GetString("file.filename"); err == nil { + testDecodeJson_Config(t, fmt.Sprintf("%v", vString), &actual.FileConfig.Filename) + + } else { + assert.FailNow(t, err.Error()) + } + }) + }) + t.Run("Test_jaeger.enabled", func(t *testing.T) { + + t.Run("Override", func(t *testing.T) { + testValue := "1" + + cmdFlags.Set("jaeger.enabled", testValue) + if vBool, err := cmdFlags.GetBool("jaeger.enabled"); err == nil { + testDecodeJson_Config(t, fmt.Sprintf("%v", vBool), &actual.JaegerConfig.Enabled) + + } else { + assert.FailNow(t, err.Error()) + } + }) + }) + t.Run("Test_jaeger.endpoint", func(t *testing.T) { + + t.Run("Override", func(t *testing.T) { + testValue := "1" + + cmdFlags.Set("jaeger.endpoint", testValue) + if vString, err := cmdFlags.GetString("jaeger.endpoint"); err == nil { + testDecodeJson_Config(t, fmt.Sprintf("%v", vString), &actual.JaegerConfig.Endpoint) + + } else { + assert.FailNow(t, err.Error()) + } + }) + }) +} diff --git a/telemetryutils/factory.go b/telemetryutils/factory.go index ab412d7..1fc731f 100644 --- a/telemetryutils/factory.go +++ b/telemetryutils/factory.go @@ -5,8 +5,6 @@ import ( "github.com/flyteorg/flytestdlib/version" - //"go.opentelemetry.io/otel" - //"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" "go.opentelemetry.io/otel/exporters/jaeger" "go.opentelemetry.io/otel/sdk/resource" @@ -15,6 +13,14 @@ import ( semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) +const ( + AdminClientTracer = "admin-client" + BlobstoreClientTracer = "blobstore-client" + DataCatalogClientTracer = "datacatalog-client" + FlytePropellerTracer = "flytepropeller" + K8sClientTracer = "k8s-client" +) + var tracerProviders = make(map[string]*trace.TracerProvider) var noopTracerProvider = rawtrace.NewNoopTracerProvider() @@ -85,6 +91,5 @@ func GetTracerProvider(serviceName string) rawtrace.TracerProvider { return t } - // TODO @hamersaw - add warning "tracerProvider 'foo' not registered" return noopTracerProvider } diff --git a/telemetryutils/k8s.go b/telemetryutils/k8s.go index 68aed08..dcbadcf 100644 --- a/telemetryutils/k8s.go +++ b/telemetryutils/k8s.go @@ -8,10 +8,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ) -const ( - K8S_SERVICE_NAME = "k8s-client" - PACKAGE = "controller-runtime.pkg.client" -) +const k8sSpanPathPrefix = "controller-runtime.pkg.client" type K8sCacheWrapper struct { cache.Cache @@ -22,13 +19,13 @@ func WrapK8sCache(c cache.Cache) cache.Cache { } func (c *K8sCacheWrapper) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error { - ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Cache/Get", PACKAGE)) + ctx, span := NewSpan(ctx, K8sClientTracer, fmt.Sprintf("%s.Cache/Get", k8sSpanPathPrefix)) defer span.End() return c.Cache.Get(ctx, key, obj) } func (c *K8sCacheWrapper) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error { - ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Cache/List", PACKAGE)) + ctx, span := NewSpan(ctx, K8sClientTracer, fmt.Sprintf("%s.Cache/List", k8sSpanPathPrefix)) defer span.End() return c.Cache.List(ctx, list, opts...) } @@ -44,43 +41,43 @@ func WrapK8sClient(c client.Client) client.Client { } func (c *K8sClientWrapper) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error { - ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Client/Get", PACKAGE)) + ctx, span := NewSpan(ctx, K8sClientTracer, fmt.Sprintf("%s.Client/Get", k8sSpanPathPrefix)) defer span.End() return c.Client.Get(ctx, key, obj) } func (c *K8sClientWrapper) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error { - ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Client/List", PACKAGE)) + ctx, span := NewSpan(ctx, K8sClientTracer, fmt.Sprintf("%s.Client/List", k8sSpanPathPrefix)) defer span.End() return c.Client.List(ctx, list, opts...) } func (c *K8sClientWrapper) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error { - ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Client/Create", PACKAGE)) + ctx, span := NewSpan(ctx, K8sClientTracer, fmt.Sprintf("%s.Client/Create", k8sSpanPathPrefix)) defer span.End() return c.Client.Create(ctx, obj, opts...) } func (c *K8sClientWrapper) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error { - ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Client/Delete", PACKAGE)) + ctx, span := NewSpan(ctx, K8sClientTracer, fmt.Sprintf("%s.Client/Delete", k8sSpanPathPrefix)) defer span.End() return c.Client.Delete(ctx, obj, opts...) } func (c *K8sClientWrapper) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error { - ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Client/Update", PACKAGE)) + ctx, span := NewSpan(ctx, K8sClientTracer, fmt.Sprintf("%s.Client/Update", k8sSpanPathPrefix)) defer span.End() return c.Client.Update(ctx, obj, opts...) } func (c *K8sClientWrapper) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error { - ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Client/Patch", PACKAGE)) + ctx, span := NewSpan(ctx, K8sClientTracer, fmt.Sprintf("%s.Client/Patch", k8sSpanPathPrefix)) defer span.End() return c.Client.Patch(ctx, obj, patch, opts...) } func (c *K8sClientWrapper) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error { - ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.Client/DeleteAllOf", PACKAGE)) + ctx, span := NewSpan(ctx, K8sClientTracer, fmt.Sprintf("%s.Client/DeleteAllOf", k8sSpanPathPrefix)) defer span.End() return c.Client.DeleteAllOf(ctx, obj, opts...) } @@ -94,13 +91,13 @@ type K8sStatusWriterWrapper struct { } func (s *K8sStatusWriterWrapper) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error { - ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.StatusWriter/Update", PACKAGE)) + ctx, span := NewSpan(ctx, K8sClientTracer, fmt.Sprintf("%s.StatusWriter/Update", k8sSpanPathPrefix)) defer span.End() return s.StatusWriter.Update(ctx, obj, opts...) } func (s *K8sStatusWriterWrapper) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error { - ctx, span := NewSpan(ctx, K8S_SERVICE_NAME, fmt.Sprintf("%s.StatusWriter/Patch", PACKAGE)) + ctx, span := NewSpan(ctx, K8sClientTracer, fmt.Sprintf("%s.StatusWriter/Patch", k8sSpanPathPrefix)) defer span.End() return s.StatusWriter.Patch(ctx, obj, patch, opts...) } diff --git a/telemetryutils/utils.go b/telemetryutils/utils.go index 4243180..bed0920 100644 --- a/telemetryutils/utils.go +++ b/telemetryutils/utils.go @@ -5,25 +5,11 @@ import ( "github.com/flyteorg/flytestdlib/contextutils" - //"go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" ) -/*func NewSpan(ctx context.Context, tracerName string, spanName string) (context.Context, trace.Span) { - var attributes []attribute.KeyValue - for key, value := range contextutils.GetLogFields(ctx) { - if value, ok := value.(string); ok { - attributes = append(attributes, attribute.String(key, value)) - } - } - - return otel.Tracer(tracerName).Start(ctx, spanName, trace.WithAttributes(attributes...)) -}*/ - func NewSpan(ctx context.Context, serviceName string, spanName string) (context.Context, trace.Span) { - // TODO @hamersaw - can check ctx.IDK to see if tracing is enabled on - var attributes []attribute.KeyValue for key, value := range contextutils.GetLogFields(ctx) { if value, ok := value.(string); ok { @@ -33,5 +19,4 @@ func NewSpan(ctx context.Context, serviceName string, spanName string) (context. tracerProvider := GetTracerProvider(serviceName) return tracerProvider.Tracer("default").Start(ctx, spanName, trace.WithAttributes(attributes...)) - // TODO @hamersaw - tracer should be the library name - ex. github.com/flyteorg/flytepropeller } From cdd23167d6347010a643ec8ac9fc42aae460a078 Mon Sep 17 00:00:00 2001 From: Daniel Rammer Date: Thu, 9 Mar 2023 08:51:38 -0600 Subject: [PATCH 7/8] fixed lint issues Signed-off-by: Daniel Rammer --- telemetryutils/config.go | 2 +- telemetryutils/factory.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/telemetryutils/config.go b/telemetryutils/config.go index bf617ab..5c1d1f2 100644 --- a/telemetryutils/config.go +++ b/telemetryutils/config.go @@ -28,7 +28,7 @@ var ( ) type Config struct { - FileConfig FileConfig `json:"file" pflag:",Configuration for exporting telemetry traces to a file"` + FileConfig FileConfig `json:"file" pflag:",Configuration for exporting telemetry traces to a file"` JaegerConfig JaegerConfig `json:"jaeger" pflag:",Configuration for exporting telemetry traces to a jaeger"` } diff --git a/telemetryutils/factory.go b/telemetryutils/factory.go index 1fc731f..a6ba0cc 100644 --- a/telemetryutils/factory.go +++ b/telemetryutils/factory.go @@ -5,12 +5,12 @@ import ( "github.com/flyteorg/flytestdlib/version" - "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" "go.opentelemetry.io/otel/exporters/jaeger" + "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/trace" - rawtrace "go.opentelemetry.io/otel/trace" semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + rawtrace "go.opentelemetry.io/otel/trace" ) const ( From be42e3f5daf24f5875acba5b6ac3bd2191eccb27 Mon Sep 17 00:00:00 2001 From: Daniel Rammer Date: Fri, 10 Mar 2023 19:50:29 -0600 Subject: [PATCH 8/8] added unit tests Signed-off-by: Daniel Rammer --- telemetryutils/factory.go | 15 ++++++++++++ telemetryutils/factory_test.go | 42 ++++++++++++++++++++++++++++++++++ telemetryutils/utils.go | 22 ------------------ 3 files changed, 57 insertions(+), 22 deletions(-) create mode 100644 telemetryutils/factory_test.go delete mode 100644 telemetryutils/utils.go diff --git a/telemetryutils/factory.go b/telemetryutils/factory.go index a6ba0cc..b9bc258 100644 --- a/telemetryutils/factory.go +++ b/telemetryutils/factory.go @@ -1,10 +1,13 @@ package telemetryutils import ( + "context" "os" + "github.com/flyteorg/flytestdlib/contextutils" "github.com/flyteorg/flytestdlib/version" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/jaeger" "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" "go.opentelemetry.io/otel/sdk/resource" @@ -93,3 +96,15 @@ func GetTracerProvider(serviceName string) rawtrace.TracerProvider { return noopTracerProvider } + +func NewSpan(ctx context.Context, serviceName string, spanName string) (context.Context, rawtrace.Span) { + var attributes []attribute.KeyValue + for key, value := range contextutils.GetLogFields(ctx) { + if value, ok := value.(string); ok { + attributes = append(attributes, attribute.String(key, value)) + } + } + + tracerProvider := GetTracerProvider(serviceName) + return tracerProvider.Tracer("default").Start(ctx, spanName, rawtrace.WithAttributes(attributes...)) +} diff --git a/telemetryutils/factory_test.go b/telemetryutils/factory_test.go new file mode 100644 index 0000000..e3647ab --- /dev/null +++ b/telemetryutils/factory_test.go @@ -0,0 +1,42 @@ +package telemetryutils + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestRegisterTracerProvider(t *testing.T) { + serviceName := "foo" + + // register tracer provider with no exporters + emptyConfig := Config{} + err := RegisterTracerProvider(serviceName, &emptyConfig) + assert.Nil(t, err) + + // validate no tracerProviders are registered + assert.Len(t, tracerProviders, 0) + + // register tracer provider with all exporters + fullConfig := Config{ + FileConfig: FileConfig{ + Enabled: true, + Filename: "/dev/null", + }, + JaegerConfig: JaegerConfig{ + Enabled: true, + }, + } + err = RegisterTracerProvider(serviceName, &fullConfig) + assert.Nil(t, err) + + // validate tracerProvider is registered + assert.Len(t, tracerProviders, 1) +} + +func TestNewSpan(t *testing.T) { + ctx := context.TODO() + _, span := NewSpan(ctx, "bar", "baz/bat") + span.End() +} diff --git a/telemetryutils/utils.go b/telemetryutils/utils.go deleted file mode 100644 index bed0920..0000000 --- a/telemetryutils/utils.go +++ /dev/null @@ -1,22 +0,0 @@ -package telemetryutils - -import ( - "context" - - "github.com/flyteorg/flytestdlib/contextutils" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/trace" -) - -func NewSpan(ctx context.Context, serviceName string, spanName string) (context.Context, trace.Span) { - var attributes []attribute.KeyValue - for key, value := range contextutils.GetLogFields(ctx) { - if value, ok := value.(string); ok { - attributes = append(attributes, attribute.String(key, value)) - } - } - - tracerProvider := GetTracerProvider(serviceName) - return tracerProvider.Tracer("default").Start(ctx, spanName, trace.WithAttributes(attributes...)) -}