Skip to content

Commit 24551ab

Browse files
dependabot[bot]andresmgotxnyo
authored
build(deps): bump go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc from 0.45.0 to 0.46.0 (#804)
* build(deps): bump go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc Bumps [go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc](https://github.com/open-telemetry/opentelemetry-go-contrib) from 0.45.0 to 0.46.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-go-contrib/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/CHANGELOG.md) - [Commits](open-telemetry/opentelemetry-go-contrib@zpages/v0.45.0...zpages/v0.46.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * Update dependent packages. Adapt code * Remove deprecated otelgrpc unary and stream server interceptors --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Andres Martinez <[email protected]> Co-authored-by: Giuseppe Guerra <[email protected]>
1 parent b79df14 commit 24551ab

File tree

6 files changed

+91
-70
lines changed

6 files changed

+91
-70
lines changed

backend/httpclient/tracing_middleware_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ import (
1111
"go.opentelemetry.io/otel/codes"
1212
"go.opentelemetry.io/otel/sdk/trace/tracetest"
1313
"go.opentelemetry.io/otel/trace"
14+
"go.opentelemetry.io/otel/trace/embedded"
1415

1516
"github.com/grafana/grafana-plugin-sdk-go/backend/httpclient"
1617
"github.com/grafana/grafana-plugin-sdk-go/internal/tracerprovider"
1718
)
1819

19-
type mockTracerProvider struct{}
20+
type mockTracerProvider struct {
21+
embedded.TracerProvider
22+
}
2023

2124
var _ trace.TracerProvider = mockTracerProvider{}
2225

@@ -25,6 +28,8 @@ func (p mockTracerProvider) Tracer(string, ...trace.TracerOption) trace.Tracer {
2528
}
2629

2730
type mockTracer struct {
31+
embedded.Tracer
32+
2833
spans []*mockSpan
2934
}
3035

@@ -41,6 +46,8 @@ func (t *mockTracer) Start(ctx context.Context, name string, opts ...trace.SpanS
4146

4247
// mockSpan is an implementation of Span that preforms no operations.
4348
type mockSpan struct {
49+
embedded.Span
50+
4451
name string
4552
ended bool
4653

backend/serve.go

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,28 @@ func asGRPCServeOpts(opts ServeOpts) grpcplugin.ServeOpts {
7878
return pluginOpts
7979
}
8080

81+
// grpcServerOptions returns a new []grpc.ServerOption that can be passed to grpc.NewServer.
82+
// The returned options are the default ones, and any customOpts are appended at the end.
83+
// The default options are:
84+
// - default middlewares (see defaultGRPCMiddlewares)
85+
// - otel grpc stats handler (see otelgrpc.NewServerHandler)
86+
func grpcServerOptions(serveOpts ServeOpts, customOpts ...grpc.ServerOption) []grpc.ServerOption {
87+
options := defaultGRPCMiddlewares(serveOpts)
88+
options = append(options, grpc.StatsHandler(otelgrpc.NewServerHandler()))
89+
options = append(options, customOpts...)
90+
return options
91+
}
92+
8193
func defaultGRPCMiddlewares(opts ServeOpts) []grpc.ServerOption {
8294
if opts.GRPCSettings.MaxReceiveMsgSize <= 0 {
8395
opts.GRPCSettings.MaxReceiveMsgSize = defaultServerMaxReceiveMessageSize
8496
}
8597
grpcMiddlewares := []grpc.ServerOption{
8698
grpc.MaxRecvMsgSize(opts.GRPCSettings.MaxReceiveMsgSize),
8799
grpc.StreamInterceptor(grpc_middleware.ChainStreamServer(
88-
otelgrpc.StreamServerInterceptor(),
89100
grpc_prometheus.StreamServerInterceptor,
90101
)),
91102
grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(
92-
otelgrpc.UnaryServerInterceptor(),
93103
grpc_prometheus.UnaryServerInterceptor,
94104
)),
95105
}
@@ -103,8 +113,8 @@ func defaultGRPCMiddlewares(opts ServeOpts) []grpc.ServerOption {
103113
func Serve(opts ServeOpts) error {
104114
grpc_prometheus.EnableHandlingTimeHistogram()
105115
pluginOpts := asGRPCServeOpts(opts)
106-
pluginOpts.GRPCServer = func(grpcOptions []grpc.ServerOption) *grpc.Server {
107-
return grpc.NewServer(append(defaultGRPCMiddlewares(opts), grpcOptions...)...)
116+
pluginOpts.GRPCServer = func(customOptions []grpc.ServerOption) *grpc.Server {
117+
return grpc.NewServer(grpcServerOptions(opts, customOptions...)...)
108118
}
109119
return grpcplugin.Serve(pluginOpts)
110120
}
@@ -155,8 +165,8 @@ func GracefulStandaloneServe(dsopts ServeOpts, info standalone.ServerSettings) e
155165
// Start GRPC server
156166
pluginOpts := asGRPCServeOpts(dsopts)
157167
if pluginOpts.GRPCServer == nil {
158-
pluginOpts.GRPCServer = func(grpcOptions []grpc.ServerOption) *grpc.Server {
159-
return grpc.NewServer(append(defaultGRPCMiddlewares(dsopts), grpcOptions...)...)
168+
pluginOpts.GRPCServer = func(customOptions []grpc.ServerOption) *grpc.Server {
169+
return grpc.NewServer(grpcServerOptions(dsopts, customOptions...)...)
160170
}
161171
}
162172

@@ -257,8 +267,8 @@ func Manage(pluginID string, serveOpts ServeOpts) error {
257267
func TestStandaloneServe(opts ServeOpts, address string) (*grpc.Server, error) {
258268
pluginOpts := asGRPCServeOpts(opts)
259269
if pluginOpts.GRPCServer == nil {
260-
pluginOpts.GRPCServer = func(grpcOptions []grpc.ServerOption) *grpc.Server {
261-
return grpc.NewServer(append(defaultGRPCMiddlewares(opts), grpcOptions...)...)
270+
pluginOpts.GRPCServer = func(customOptions []grpc.ServerOption) *grpc.Server {
271+
return grpc.NewServer(grpcServerOptions(opts, customOptions...)...)
262272
}
263273
}
264274

backend/tracing/contextual_tracer.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
"go.opentelemetry.io/otel/attribute"
77
"go.opentelemetry.io/otel/trace"
8+
"go.opentelemetry.io/otel/trace/embedded"
89

910
"github.com/grafana/grafana-plugin-sdk-go/internal/tenant"
1011
)
@@ -16,6 +17,8 @@ const (
1617
// contextualTracer is a wrapper around a trace.Tracer that adds contextual attributes to spans.
1718
// This is the default tracer used by the SDK.
1819
type contextualTracer struct {
20+
embedded.Tracer
21+
1922
tracer trace.Tracer
2023
}
2124

go.mod

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.21
55
require (
66
github.com/cheekybits/genny v1.0.0
77
github.com/golang/protobuf v1.5.3 // indirect
8-
github.com/google/go-cmp v0.5.9
8+
github.com/google/go-cmp v0.6.0
99
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
1010
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
1111
github.com/hashicorp/go-hclog v1.5.0
@@ -20,8 +20,8 @@ require (
2020
github.com/prometheus/client_golang v1.14.0
2121
github.com/prometheus/common v0.42.0
2222
github.com/stretchr/testify v1.8.4
23-
golang.org/x/sys v0.13.0
24-
google.golang.org/grpc v1.58.3
23+
golang.org/x/sys v0.14.0
24+
google.golang.org/grpc v1.59.0
2525
google.golang.org/protobuf v1.31.0
2626
gopkg.in/yaml.v3 v3.0.1 // indirect
2727
)
@@ -32,20 +32,20 @@ require (
3232
github.com/elazarl/goproxy v0.0.0-20230731152917-f99041a5c027
3333
github.com/getkin/kin-openapi v0.120.0
3434
github.com/go-jose/go-jose/v3 v3.0.0
35-
github.com/google/uuid v1.3.0
35+
github.com/google/uuid v1.3.1
3636
github.com/unknwon/bra v0.0.0-20200517080246-1e3013ecaff8
3737
github.com/urfave/cli v1.22.14
38-
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0
39-
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.45.0
38+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0
39+
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.46.0
4040
go.opentelemetry.io/contrib/propagators/jaeger v1.20.0
4141
go.opentelemetry.io/contrib/samplers/jaegerremote v0.14.0
42-
go.opentelemetry.io/otel v1.19.0
43-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0
44-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0
45-
go.opentelemetry.io/otel/sdk v1.19.0
46-
go.opentelemetry.io/otel/trace v1.19.0
42+
go.opentelemetry.io/otel v1.20.0
43+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0
44+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0
45+
go.opentelemetry.io/otel/sdk v1.20.0
46+
go.opentelemetry.io/otel/trace v1.20.0
4747
golang.org/x/net v0.17.0
48-
golang.org/x/oauth2 v0.10.0
48+
golang.org/x/oauth2 v0.11.0
4949
golang.org/x/text v0.13.0
5050
)
5151

@@ -58,7 +58,7 @@ require (
5858
github.com/davecgh/go-spew v1.1.1 // indirect
5959
github.com/elazarl/goproxy/ext v0.0.0-20220115173737-adb46da277ac // indirect
6060
github.com/fatih/color v1.15.0 // indirect
61-
github.com/go-logr/logr v1.2.4 // indirect
61+
github.com/go-logr/logr v1.3.0 // indirect
6262
github.com/go-logr/stdr v1.2.2 // indirect
6363
github.com/go-openapi/jsonpointer v0.19.6 // indirect
6464
github.com/go-openapi/swag v0.22.4 // indirect
@@ -90,15 +90,15 @@ require (
9090
github.com/unknwon/com v1.0.1 // indirect
9191
github.com/unknwon/log v0.0.0-20150304194804-e617c87089d3 // indirect
9292
github.com/zeebo/xxh3 v1.0.2 // indirect
93-
go.opentelemetry.io/otel/metric v1.19.0 // indirect
93+
go.opentelemetry.io/otel/metric v1.20.0 // indirect
9494
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
9595
golang.org/x/crypto v0.14.0 // indirect
9696
golang.org/x/mod v0.9.0 // indirect
9797
golang.org/x/tools v0.6.0 // indirect
9898
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
9999
google.golang.org/appengine v1.6.7 // indirect
100-
google.golang.org/genproto v0.0.0-20230731193218-e0aa005b6bdf // indirect
101-
google.golang.org/genproto/googleapis/api v0.0.0-20230731193218-e0aa005b6bdf // indirect
102-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731193218-e0aa005b6bdf // indirect
100+
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
101+
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
102+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
103103
gopkg.in/fsnotify/fsnotify.v1 v1.4.7 // indirect
104104
)

0 commit comments

Comments
 (0)