From eca58787cdb9ffc0ccd45a20dbf44e14a0692852 Mon Sep 17 00:00:00 2001 From: Felipe Lee Date: Thu, 1 Jun 2023 01:02:17 +0000 Subject: [PATCH] chore: upgrade otel dependencies The only breaking change I saw was the removal of the `otel/metric/global` package. We instead need to use the base `otel` package, and the method names changed a bit: 1.16.0-rc.1 Relevant Notes: * The `go.opentelemetry.io/otel/metric/global` package is removed. Use `go.opentelemetry.io/otel` instead. [otel #4039](https://github.com/open-telemetry/opentelemetry-go/pull/4039) * Support global `MeterProvider` in `go.opentelemetry.io/otel`. [otel #4039](https://github.com/open-telemetry/opentelemetry-go/pull/4039) * Use `Meter` for a `metric.Meter` from the global `metric.MeterProvider`. * Use `GetMeterProivder` for a global `metric.MeterProvider`. * Use `SetMeterProivder` to set the global `metric.MeterProvider`. JIRA Ticket: MB-15974 --- go.mod | 40 ++++++++------- go.sum | 80 ++++++++++++++++-------------- pkg/telemetry/db.go | 4 +- pkg/telemetry/db_test.go | 4 +- pkg/telemetry/init.go | 5 +- pkg/telemetry/init_test.go | 5 +- pkg/telemetry/milmove_data.go | 4 +- pkg/telemetry/milmove_data_test.go | 4 +- pkg/telemetry/request.go | 4 +- pkg/telemetry/request_test.go | 4 +- 10 files changed, 79 insertions(+), 75 deletions(-) diff --git a/go.mod b/go.mod index b51601473cb..4eb4ac4b692 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/DATA-DOG/go-txdb v0.1.5 - github.com/XSAM/otelsql v0.22.0 + github.com/XSAM/otelsql v0.23.0 github.com/alexedwards/scs/redisstore v0.0.0-20221223131519-238b052508b6 github.com/alexedwards/scs/v2 v2.5.1 github.com/aws/aws-sdk-go v1.44.267 @@ -63,21 +63,21 @@ require ( github.com/tiaguinho/gosoap v1.4.4 github.com/vektra/mockery/v2 v2.28.0 go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 - go.opentelemetry.io/contrib/detectors/aws/ecs v1.16.1 - go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.41.1 - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.41.1 - go.opentelemetry.io/contrib/instrumentation/runtime v0.41.1 - go.opentelemetry.io/contrib/propagators/aws v1.16.1 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.38.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.38.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 - go.opentelemetry.io/otel/metric v0.38.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/sdk/metric v0.38.1 - go.opentelemetry.io/otel/trace v1.15.1 + go.opentelemetry.io/contrib/detectors/aws/ecs v1.17.0 + go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.42.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 + go.opentelemetry.io/contrib/instrumentation/runtime v0.42.0 + go.opentelemetry.io/contrib/propagators/aws v1.17.0 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.39.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.39.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0 + go.opentelemetry.io/otel/metric v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/sdk/metric v0.39.0 + go.opentelemetry.io/otel/trace v1.16.0 go.uber.org/zap v1.24.0 golang.org/x/crypto v0.9.0 golang.org/x/net v0.10.0 @@ -200,8 +200,8 @@ require ( github.com/urfave/cli v1.22.10 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect go.mongodb.org/mongo-driver v1.11.3 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect @@ -212,7 +212,9 @@ require ( golang.org/x/sys v0.8.0 // indirect golang.org/x/term v0.8.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect + google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/grpc v1.55.0 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect diff --git a/go.sum b/go.sum index 790c4fe64aa..2e5b2ea2406 100644 --- a/go.sum +++ b/go.sum @@ -69,8 +69,8 @@ github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBa github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/XSAM/otelsql v0.22.0 h1:ximAhitmcxmG8IIFSpDTpYqSBC/I6e5ojVOLkVGcdXU= -github.com/XSAM/otelsql v0.22.0/go.mod h1:tjkdeLCwuYQtANlkBQxdtFmJQzuYRFKEl4osiqNx2+M= +github.com/XSAM/otelsql v0.23.0 h1:NsJQS9YhI1+RDsFqE9mW5XIQmPmdF/qa8qQOLZN8XEA= +github.com/XSAM/otelsql v0.23.0/go.mod h1:oX4LXMsb+9lAZhvHjUS61oQP/hbcJRadWHnBKNL+LuM= github.com/alexedwards/scs/redisstore v0.0.0-20221223131519-238b052508b6 h1:75FM2L3Hup1DEpcsz+A+sdwoLdxR5yM+ecGYWkgVzW0= github.com/alexedwards/scs/redisstore v0.0.0-20221223131519-238b052508b6/go.mod h1:ceKFatoD+hfHWWeHOAYue1J+XgOJjE7dw8l3JtIRTGY= github.com/alexedwards/scs/v2 v2.5.1 h1:EhAz3Kb3OSQzD8T+Ub23fKsiuvE0GzbF5Lgn0uTwM3Y= @@ -749,40 +749,40 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= 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.opentelemetry.io/contrib/detectors/aws/ecs v1.16.1 h1:X10aGC4/BZUUqrvXHQWGjqcXl6VTy98Z5noQrvKmZ58= -go.opentelemetry.io/contrib/detectors/aws/ecs v1.16.1/go.mod h1:OshtJzwB+6SKoFM4ovJIbsHuwg7PpLGIbpaAOHJwyUU= -go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.41.1 h1:+dnM18FnwN3FC+0qquugd6cT4csOj4o5OXfWVYkrhys= -go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.41.1/go.mod h1:CY62MFODuCVxifusuibZ8c6G1lQlfVhgi59NrKehMxQ= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.41.1 h1:pX+lppB8PArapyhS6nBStyQmkaDUPWdQf0UmEGRCQ54= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.41.1/go.mod h1:2FmkXne0k9nkp27LD/m+uoh8dNlstsiCJ7PLc/S72aI= -go.opentelemetry.io/contrib/instrumentation/runtime v0.41.1 h1:KXWR7rFIuQLMo/dHu/DTev7qdQdTuGCxTfEUZdLaMfs= -go.opentelemetry.io/contrib/instrumentation/runtime v0.41.1/go.mod h1:fNv3vYJmbcUl4qVQK9tbAVBQjTAbfDDQa/cFgpOTm50= -go.opentelemetry.io/contrib/propagators/aws v1.16.1 h1:Jf017vtD4kDqpK1YKafZLLGYoQX5Qp5yn0NIEUDYmHc= -go.opentelemetry.io/contrib/propagators/aws v1.16.1/go.mod h1:X+DmBEHeFa1F82LtjVsw37nyEZIdeI2tY2ZaDczg+e8= -go.opentelemetry.io/otel v1.15.1 h1:3Iwq3lfRByPaws0f6bU3naAqOR1n5IeDWd9390kWHa8= -go.opentelemetry.io/otel v1.15.1/go.mod h1:mHHGEHVDLal6YrKMmk9LqC4a3sF5g+fHfrttQIB1NTc= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 h1:XYDQtNzdb2T4uM1pku2m76eSMDJgqhJ+6KzkqgQBALc= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1/go.mod h1:uOTV75+LOzV+ODmL8ahRLWkFA3eQcSC2aAsbxIu4duk= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.1 h1:MSGZwWn8Ji4b6UWkB7pYPgTiTmWM3S4lro9Y+5c3WmE= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.1/go.mod h1:GFYZ2ebv/Bwont+pVaXHTGncGz93MjvTgZrskegEOUI= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.38.1 h1:lIhD5oa2k9Lw4oxtl1ECNOrPaX61NjRo8hp+8lDEn4w= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.38.1/go.mod h1:1z3PiBAi38sdOEIVrjCYtDy5kW2hPWXdF8jJolsSBKg= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 h1:tyoeaUh8REKay72DVYsSEBYV18+fGONe+YYPaOxgLoE= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1/go.mod h1:HUSnrjQQ19KX9ECjpQxufsF+3ioD3zISPMlauTPZu2g= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 h1:pIfoG5IAZFzp9EUlJzdSkpUwpaUAAnD+Ru1nBLTACIQ= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1/go.mod h1:poNKBqF5+nR/6ke2oGTDjHfksrsHDOHXAl2g4+9ONsY= -go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.38.1 h1:6TvZFbbmzGAkPNFOtYXaXfKy9acwzBMoThVZ2S8VsDs= -go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.38.1/go.mod h1:AKWhQiOkSfvMWmQuk54+m+EhlBC5gQHsmaUCM1HCA/U= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 h1:2PunuO5SbkN5MhCbuHCd3tC6qrcaj+uDAkX/qBU5BAs= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1/go.mod h1:q8+Tha+5LThjeSU8BW93uUC5w5/+DnYHMKBMpRCsui0= -go.opentelemetry.io/otel/metric v0.38.1 h1:2MM7m6wPw9B8Qv8iHygoAgkbejed59uUR6ezR5T3X2s= -go.opentelemetry.io/otel/metric v0.38.1/go.mod h1:FwqNHD3I/5iX9pfrRGZIlYICrJv0rHEUl2Ln5vdIVnQ= -go.opentelemetry.io/otel/sdk v1.15.1 h1:5FKR+skgpzvhPQHIEfcwMYjCBr14LWzs3uSqKiQzETI= -go.opentelemetry.io/otel/sdk v1.15.1/go.mod h1:8rVtxQfrbmbHKfqzpQkT5EzZMcbMBwTzNAggbEAM0KA= -go.opentelemetry.io/otel/sdk/metric v0.38.1 h1:EkO5wI4NT/fUaoPMGc0fKV28JaWe7q4vfVpEVasGb+8= -go.opentelemetry.io/otel/sdk/metric v0.38.1/go.mod h1:Rn4kSXFF9ZQZ5lL1pxQjCbK4seiO+U7s0ncmIFJaj34= -go.opentelemetry.io/otel/trace v1.15.1 h1:uXLo6iHJEzDfrNC0L0mNjItIp06SyaBQxu5t3xMlngY= -go.opentelemetry.io/otel/trace v1.15.1/go.mod h1:IWdQG/5N1x7f6YUlmdLeJvH9yxtuJAfc4VW5Agv9r/8= +go.opentelemetry.io/contrib/detectors/aws/ecs v1.17.0 h1:mVgyT8yiXLU4+pHqKf0KuoWxuuiIir0P5aBfcd9SdgA= +go.opentelemetry.io/contrib/detectors/aws/ecs v1.17.0/go.mod h1:CJt8pTOejP+Z2CCNFt0s4DFY21E5OE+qvCp8l4+nPng= +go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.42.0 h1:M21Uhqx97uKzB9NhtPxUGT1EzP/AkLaVHD5vib+qoK4= +go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.42.0/go.mod h1:hZGj9DTQYUAszT7dWME6Ls2nWHrJAyyjTtBrBvK6QJw= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 h1:pginetY7+onl4qN1vl0xW/V/v6OBZ0vVdH+esuJgvmM= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0/go.mod h1:XiYsayHc36K3EByOO6nbAXnAWbrUxdjUROCEeeROOH8= +go.opentelemetry.io/contrib/instrumentation/runtime v0.42.0 h1:EbmAUG9hEAMXyfWEasIt2kmh/WmXUznUksChApTgBGc= +go.opentelemetry.io/contrib/instrumentation/runtime v0.42.0/go.mod h1:rD9feqRYP24P14t5kmhNMqsqm1jvKmpx2H2rKVw52V8= +go.opentelemetry.io/contrib/propagators/aws v1.17.0 h1:IX8d7l2uRw61BlmZBOTQFaK+y22j6vytMVTs9wFrO+c= +go.opentelemetry.io/contrib/propagators/aws v1.17.0/go.mod h1:pAlCYRWff4uGqRXOVn3WP8pDZ5E0K56bEoG7a1VSL4k= +go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= +go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 h1:t4ZwRPU+emrcvM2e9DHd0Fsf0JTPVcbfa/BhTDF03d0= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0/go.mod h1:vLarbg68dH2Wa77g71zmKQqlQ8+8Rq3GRG31uc0WcWI= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 h1:f6BwB2OACc3FCbYVznctQ9V6KK7Vq6CjmYXJ7DeSs4E= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0/go.mod h1:UqL5mZ3qs6XYhDnZaW1Ps4upD+PX6LipH40AoeuIlwU= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.39.0 h1:rm+Fizi7lTM2UefJ1TO347fSRcwmIsUAaZmYmIGBRAo= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.39.0/go.mod h1:sWFbI3jJ+6JdjOVepA5blpv/TJ20Hw+26561iMbWcwU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 h1:cbsD4cUcviQGXdw8+bo5x2wazq10SKz8hEbtCRPcU78= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0/go.mod h1:JgXSGah17croqhJfhByOLVY719k1emAXC8MVhCIJlRs= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 h1:TVQp/bboR4mhZSav+MdgXB8FaRho1RC8UwVn3T0vjVc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0/go.mod h1:I33vtIe0sR96wfrUcilIzLoA3mLHhRmz9S9Te0S3gDo= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.39.0 h1:fl2WmyenEf6LYYlfHAtCUEDyGcpwJNqD4dHGO7PVm4w= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.39.0/go.mod h1:csyQxQ0UHHKVA8KApS7eUO/klMO5sd/av5CNZNU4O6w= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0 h1:+XWJd3jf75RXJq29mxbuXhCXFDG3S3R4vBUeSI2P7tE= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0/go.mod h1:hqgzBPTf4yONMFgdZvL/bK42R/iinTyVQtiWihs3SZc= +go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo= +go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4= +go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE= +go.opentelemetry.io/otel/sdk v1.16.0/go.mod h1:tMsIuKXuuIWPBAOrH+eHtvhTL+SntFtXF9QD68aP6p4= +go.opentelemetry.io/otel/sdk/metric v0.39.0 h1:Kun8i1eYf48kHH83RucG93ffz0zGV1sh46FAScOTuDI= +go.opentelemetry.io/otel/sdk/metric v0.39.0/go.mod h1:piDIRgjcK7u0HCL5pCA4e74qpK/jk3NiUoAHATVAmiI= +go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= +go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= @@ -1182,8 +1182,12 @@ google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= +google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc h1:8DyZCyvI8mE1IdLy/60bS+52xfymkE72wv1asokgtao= +google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/pkg/telemetry/db.go b/pkg/telemetry/db.go index ee9b2c1ff65..d6aa703f7cb 100644 --- a/pkg/telemetry/db.go +++ b/pkg/telemetry/db.go @@ -5,8 +5,8 @@ import ( "sync" "time" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/global" "github.com/transcom/mymove/pkg/appcontext" "github.com/transcom/mymove/pkg/db/stats" @@ -23,7 +23,7 @@ func RegisterDBStatsObserver(appCtx appcontext.AppContext, config *Config) error return nil } - meterProvider := global.MeterProvider() + meterProvider := otel.GetMeterProvider() dbMeter := meterProvider.Meter("github.com/transcom/mymove/db", metric.WithInstrumentationVersion(dbTelemetryVersion)) diff --git a/pkg/telemetry/db_test.go b/pkg/telemetry/db_test.go index 660f6d7238d..57baa4d8206 100644 --- a/pkg/telemetry/db_test.go +++ b/pkg/telemetry/db_test.go @@ -6,7 +6,7 @@ import ( "io" "os" - "go.opentelemetry.io/otel/metric/global" + "go.opentelemetry.io/otel" sdkmetric "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -35,7 +35,7 @@ func (suite *TelemetrySuite) TestDBStatsObserver() { err = RegisterDBStatsObserver(suite.AppContextForTest(), config) suite.Assert().NoError(err) - mp := global.MeterProvider() + mp := otel.GetMeterProvider() ctx := context.Background() mmp, ok := mp.(*sdkmetric.MeterProvider) if !ok { diff --git a/pkg/telemetry/init.go b/pkg/telemetry/init.go index 81a1b2fe021..6498d3c4008 100644 --- a/pkg/telemetry/init.go +++ b/pkg/telemetry/init.go @@ -15,7 +15,6 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" - "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/propagation" sdkmetric "go.opentelemetry.io/otel/sdk/metric" @@ -53,7 +52,7 @@ func Init(logger *zap.Logger, config *Config) (shutdown func()) { if !config.Enabled { tp := trace.NewNoopTracerProvider() otel.SetTracerProvider(tp) - global.SetMeterProvider(noop.NewMeterProvider()) + otel.SetMeterProvider(noop.NewMeterProvider()) logger.Info("opentelemetry not enabled") return shutdown } @@ -171,7 +170,7 @@ func Init(logger *zap.Logger, config *Config) (shutdown func()) { } otel.SetTracerProvider(tp) - global.SetMeterProvider(mp) + otel.SetMeterProvider(mp) if config.UseXrayID { otel.SetTextMapPropagator( propagation.NewCompositeTextMapPropagator( diff --git a/pkg/telemetry/init_test.go b/pkg/telemetry/init_test.go index 29a8856097d..7897a7b7320 100644 --- a/pkg/telemetry/init_test.go +++ b/pkg/telemetry/init_test.go @@ -10,7 +10,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/metric/noop" sdkmetric "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -25,7 +24,7 @@ func (suite *TelemetrySuite) TestInitConfigDisabled() { Init(suite.Logger(), config) suite.Equal(trace.NewNoopTracerProvider(), otel.GetTracerProvider()) - suite.Equal(noop.NewMeterProvider(), global.MeterProvider()) + suite.Equal(noop.NewMeterProvider(), otel.GetMeterProvider()) } func (suite *TelemetrySuite) TestInitConfigStdoutTrace() { @@ -93,7 +92,7 @@ func (suite *TelemetrySuite) TestInitConfigStdoutMetric() { shutdownFn := Init(suite.Logger(), config) defer shutdownFn() - mp := global.MeterProvider() + mp := otel.GetMeterProvider() meter := mp.Meter("test_meter", metric.WithSchemaURL("url")) counter, err := meter.Int64Counter("test_counter") suite.NoError(err) diff --git a/pkg/telemetry/milmove_data.go b/pkg/telemetry/milmove_data.go index d174518363b..3e51ee59a94 100644 --- a/pkg/telemetry/milmove_data.go +++ b/pkg/telemetry/milmove_data.go @@ -5,8 +5,8 @@ import ( "sync" "time" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/global" "go.uber.org/zap" "github.com/transcom/mymove/pkg/appcontext" @@ -183,7 +183,7 @@ func RegisterMilmoveDataObserver(appCtx appcontext.AppContext, config *Config) e return nil } - meterProvider := global.MeterProvider() + meterProvider := otel.GetMeterProvider() milmoveDataMeter := meterProvider.Meter("github.com/transcom/mymove/data", metric.WithInstrumentationVersion("0.4")) diff --git a/pkg/telemetry/milmove_data_test.go b/pkg/telemetry/milmove_data_test.go index 9dc36c5a0a4..89728b7b32e 100644 --- a/pkg/telemetry/milmove_data_test.go +++ b/pkg/telemetry/milmove_data_test.go @@ -7,7 +7,7 @@ import ( "os" "strings" - "go.opentelemetry.io/otel/metric/global" + "go.opentelemetry.io/otel" sdkmetric "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -44,7 +44,7 @@ func (suite *TelemetrySuite) TestMilmoveDataObserver() { err = RegisterMilmoveDataObserver(suite.AppContextForTest(), config) suite.Assert().NoError(err) - mp := global.MeterProvider() + mp := otel.GetMeterProvider() ctx := context.Background() mmp, ok := mp.(*sdkmetric.MeterProvider) if !ok { diff --git a/pkg/telemetry/request.go b/pkg/telemetry/request.go index 362185aad6f..1037381810f 100644 --- a/pkg/telemetry/request.go +++ b/pkg/telemetry/request.go @@ -5,9 +5,9 @@ import ( "github.com/felixge/httpsnoop" "github.com/gorilla/mux" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/semconv/v1.13.0/httpconv" semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.uber.org/zap" @@ -21,7 +21,7 @@ type RequestTelemetry struct { const requestTelemetryVersion = "0.1" func NewRequestTelemetry(logger *zap.Logger) *RequestTelemetry { - meterProvider := global.MeterProvider() + meterProvider := otel.GetMeterProvider() requestMeter := meterProvider.Meter("github.com/transcom/mymove/request", metric.WithInstrumentationVersion(requestTelemetryVersion)) diff --git a/pkg/telemetry/request_test.go b/pkg/telemetry/request_test.go index 2b900f9f902..36aed14f8e3 100644 --- a/pkg/telemetry/request_test.go +++ b/pkg/telemetry/request_test.go @@ -8,7 +8,7 @@ import ( "os" "github.com/felixge/httpsnoop" - "go.opentelemetry.io/otel/metric/global" + "go.opentelemetry.io/otel" sdkmetric "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -44,7 +44,7 @@ func (suite *TelemetrySuite) TestRequestStats() { } rt.HandleRequest(req, metrics) - mp := global.MeterProvider() + mp := otel.GetMeterProvider() ctx := context.Background() mmp, ok := mp.(*sdkmetric.MeterProvider) if !ok {