From 9d79a62c356e207c2ca12617ed702729ed918e87 Mon Sep 17 00:00:00 2001 From: Anthony J Mirabella Date: Wed, 18 Jan 2023 17:03:12 -0500 Subject: [PATCH 1/2] Remove expensive calculation of gRPC message size Signed-off-by: Anthony J Mirabella --- CHANGELOG.md | 4 ++ .../grpc/otelgrpc/interceptor.go | 20 ++---- .../grpc/otelgrpc/test/grpc_test.go | 43 ------------- .../grpc/otelgrpc/test/interceptor_test.go | 62 +++++++------------ 4 files changed, 34 insertions(+), 95 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c17288ba94..e1e0c379312 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `otelmux`: Add new `WithSpanNameFormatter` option to `go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux` to allow customizing span names. (#3041) - Improve documentation for `samplers/jaegerremote` by providing examples of sampling endpoints. (#3147) +### Changed + +- `otelgrpc`: Remove expensive calculation of uncompressed message size attribute. (#3168) + ## [1.12.0/0.37.0/0.6.0] ### Added diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go b/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go index aeee1d18dbd..339e3d140ff 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go @@ -39,24 +39,16 @@ import ( type messageType attribute.KeyValue // Event adds an event of the messageType to the span associated with the -// passed context with id and size (if message is a proto message). -func (m messageType) Event(ctx context.Context, id int, message interface{}) { +// passed context with a message id. +func (m messageType) Event(ctx context.Context, id int, _ interface{}) { span := trace.SpanFromContext(ctx) if !span.IsRecording() { return } - if p, ok := message.(proto.Message); ok { - span.AddEvent("message", trace.WithAttributes( - attribute.KeyValue(m), - RPCMessageIDKey.Int(id), - RPCMessageUncompressedSizeKey.Int(proto.Size(p)), - )) - } else { - span.AddEvent("message", trace.WithAttributes( - attribute.KeyValue(m), - RPCMessageIDKey.Int(id), - )) - } + span.AddEvent("message", trace.WithAttributes( + attribute.KeyValue(m), + RPCMessageIDKey.Int(id), + )) } var ( diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/test/grpc_test.go b/instrumentation/google.golang.org/grpc/otelgrpc/test/grpc_test.go index 9d5a87687d8..b6154ef5080 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/test/grpc_test.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/test/grpc_test.go @@ -133,7 +133,6 @@ func checkUnaryClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(0), }, }, { @@ -141,7 +140,6 @@ func checkUnaryClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(0), }, }, }, emptySpan.Events()) @@ -162,7 +160,6 @@ func checkUnaryClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("SENT"), // largeReqSize from "google.golang.org/grpc/interop" + 12 (overhead). - otelgrpc.RPCMessageUncompressedSizeKey.Int(271840), }, }, { @@ -171,7 +168,6 @@ func checkUnaryClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), // largeRespSize from "google.golang.org/grpc/interop" + 8 (overhead). - otelgrpc.RPCMessageUncompressedSizeKey.Int(314167), }, }, }, largeSpan.Events()) @@ -196,7 +192,6 @@ func checkStreamClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(27190), }, }, { @@ -204,7 +199,6 @@ func checkStreamClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(2), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(12), }, }, { @@ -212,7 +206,6 @@ func checkStreamClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(3), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(1834), }, }, { @@ -220,7 +213,6 @@ func checkStreamClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(4), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(45912), }, }, // client does not record an event for the server response. @@ -242,7 +234,6 @@ func checkStreamClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(21), }, }, { @@ -250,7 +241,6 @@ func checkStreamClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(31423), }, }, { @@ -258,7 +248,6 @@ func checkStreamClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(2), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(13), }, }, { @@ -266,7 +255,6 @@ func checkStreamClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(3), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(2659), }, }, { @@ -274,7 +262,6 @@ func checkStreamClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(4), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(58987), }, }, }, streamOutput.Events()) @@ -294,7 +281,6 @@ func checkStreamClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(27196), }, }, { @@ -302,7 +288,6 @@ func checkStreamClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(31423), }, }, { @@ -310,7 +295,6 @@ func checkStreamClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(2), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(16), }, }, { @@ -318,7 +302,6 @@ func checkStreamClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(2), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(13), }, }, { @@ -326,7 +309,6 @@ func checkStreamClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(3), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(1839), }, }, { @@ -334,7 +316,6 @@ func checkStreamClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(3), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(2659), }, }, { @@ -342,7 +323,6 @@ func checkStreamClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(4), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(45918), }, }, { @@ -350,7 +330,6 @@ func checkStreamClientSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(4), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(58987), }, }, }, pingPong.Events()) @@ -375,7 +354,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(27190), }, }, { @@ -383,7 +361,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(2), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(12), }, }, { @@ -391,7 +368,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(3), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(1834), }, }, { @@ -399,7 +375,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(4), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(45912), }, }, { @@ -407,7 +382,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(4), }, }, }, streamInput.Events()) @@ -428,7 +402,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(21), }, }, { @@ -436,7 +409,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(31423), }, }, { @@ -444,7 +416,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(2), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(13), }, }, { @@ -452,7 +423,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(3), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(2659), }, }, { @@ -460,7 +430,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(4), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(58987), }, }, }, streamOutput.Events()) @@ -480,7 +449,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(27196), }, }, { @@ -488,7 +456,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(31423), }, }, { @@ -496,7 +463,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(2), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(16), }, }, { @@ -504,7 +470,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(2), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(13), }, }, { @@ -512,7 +477,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(3), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(1839), }, }, { @@ -520,7 +484,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(3), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(2659), }, }, { @@ -528,7 +491,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(4), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(45918), }, }, { @@ -536,7 +498,6 @@ func checkStreamServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(4), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(58987), }, }, }, pingPong.Events()) @@ -560,7 +521,6 @@ func checkUnaryServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(0), }, }, { @@ -568,7 +528,6 @@ func checkUnaryServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { Attributes: []attribute.KeyValue{ otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("SENT"), - otelgrpc.RPCMessageUncompressedSizeKey.Int(0), }, }, }, emptySpan.Events()) @@ -589,7 +548,6 @@ func checkUnaryServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("RECEIVED"), // largeReqSize from "google.golang.org/grpc/interop" + 12 (overhead). - otelgrpc.RPCMessageUncompressedSizeKey.Int(271840), }, }, { @@ -598,7 +556,6 @@ func checkUnaryServerSpans(t *testing.T, spans []trace.ReadOnlySpan) { otelgrpc.RPCMessageIDKey.Int(1), otelgrpc.RPCMessageTypeKey.String("SENT"), // largeRespSize from "google.golang.org/grpc/interop" + 8 (overhead). - otelgrpc.RPCMessageUncompressedSizeKey.Int(314167), }, }, }, largeSpan.Events()) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/test/interceptor_test.go b/instrumentation/google.golang.org/grpc/otelgrpc/test/interceptor_test.go index 89bf1beeaa0..ca03eb679b3 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/test/interceptor_test.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/test/interceptor_test.go @@ -39,7 +39,6 @@ import ( "google.golang.org/grpc/interop/grpc_testing" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" ) func getSpanFromRecorder(sr *tracetest.SpanRecorder, name string) (trace.ReadOnlySpan, bool) { @@ -102,14 +101,12 @@ func TestUnaryClientInterceptor(t *testing.T) { }, eventsAttr: []map[attribute.Key]attribute.Value{ { - otelgrpc.RPCMessageTypeKey: attribute.StringValue("SENT"), - otelgrpc.RPCMessageIDKey: attribute.IntValue(1), - otelgrpc.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(req)), + otelgrpc.RPCMessageTypeKey: attribute.StringValue("SENT"), + otelgrpc.RPCMessageIDKey: attribute.IntValue(1), }, { - otelgrpc.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), - otelgrpc.RPCMessageIDKey: attribute.IntValue(1), - otelgrpc.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(reply)), + otelgrpc.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + otelgrpc.RPCMessageIDKey: attribute.IntValue(1), }, }, }, @@ -126,14 +123,12 @@ func TestUnaryClientInterceptor(t *testing.T) { }, eventsAttr: []map[attribute.Key]attribute.Value{ { - otelgrpc.RPCMessageTypeKey: attribute.StringValue("SENT"), - otelgrpc.RPCMessageIDKey: attribute.IntValue(1), - otelgrpc.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(req)), + otelgrpc.RPCMessageTypeKey: attribute.StringValue("SENT"), + otelgrpc.RPCMessageIDKey: attribute.IntValue(1), }, { - otelgrpc.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), - otelgrpc.RPCMessageIDKey: attribute.IntValue(1), - otelgrpc.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(reply)), + otelgrpc.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + otelgrpc.RPCMessageIDKey: attribute.IntValue(1), }, }, }, @@ -150,14 +145,12 @@ func TestUnaryClientInterceptor(t *testing.T) { }, eventsAttr: []map[attribute.Key]attribute.Value{ { - otelgrpc.RPCMessageTypeKey: attribute.StringValue("SENT"), - otelgrpc.RPCMessageIDKey: attribute.IntValue(1), - otelgrpc.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(req)), + otelgrpc.RPCMessageTypeKey: attribute.StringValue("SENT"), + otelgrpc.RPCMessageIDKey: attribute.IntValue(1), }, { - otelgrpc.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), - otelgrpc.RPCMessageIDKey: attribute.IntValue(1), - otelgrpc.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(reply)), + otelgrpc.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + otelgrpc.RPCMessageIDKey: attribute.IntValue(1), }, }, }, @@ -175,14 +168,12 @@ func TestUnaryClientInterceptor(t *testing.T) { }, eventsAttr: []map[attribute.Key]attribute.Value{ { - otelgrpc.RPCMessageTypeKey: attribute.StringValue("SENT"), - otelgrpc.RPCMessageIDKey: attribute.IntValue(1), - otelgrpc.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(req)), + otelgrpc.RPCMessageTypeKey: attribute.StringValue("SENT"), + otelgrpc.RPCMessageIDKey: attribute.IntValue(1), }, { - otelgrpc.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), - otelgrpc.RPCMessageIDKey: attribute.IntValue(1), - otelgrpc.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(reply)), + otelgrpc.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + otelgrpc.RPCMessageIDKey: attribute.IntValue(1), }, }, expectErr: true, @@ -198,14 +189,12 @@ func TestUnaryClientInterceptor(t *testing.T) { }, eventsAttr: []map[attribute.Key]attribute.Value{ { - otelgrpc.RPCMessageTypeKey: attribute.StringValue("SENT"), - otelgrpc.RPCMessageIDKey: attribute.IntValue(1), - otelgrpc.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(req)), + otelgrpc.RPCMessageTypeKey: attribute.StringValue("SENT"), + otelgrpc.RPCMessageIDKey: attribute.IntValue(1), }, { - otelgrpc.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), - otelgrpc.RPCMessageIDKey: attribute.IntValue(1), - otelgrpc.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(reply)), + otelgrpc.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + otelgrpc.RPCMessageIDKey: attribute.IntValue(1), }, }, }, @@ -222,14 +211,12 @@ func TestUnaryClientInterceptor(t *testing.T) { }, eventsAttr: []map[attribute.Key]attribute.Value{ { - otelgrpc.RPCMessageTypeKey: attribute.StringValue("SENT"), - otelgrpc.RPCMessageIDKey: attribute.IntValue(1), - otelgrpc.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(req)), + otelgrpc.RPCMessageTypeKey: attribute.StringValue("SENT"), + otelgrpc.RPCMessageIDKey: attribute.IntValue(1), }, { - otelgrpc.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), - otelgrpc.RPCMessageIDKey: attribute.IntValue(1), - otelgrpc.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(reply)), + otelgrpc.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + otelgrpc.RPCMessageIDKey: attribute.IntValue(1), }, }, }, @@ -594,7 +581,6 @@ func TestServerInterceptorError(t *testing.T) { assert.ElementsMatch(t, []attribute.KeyValue{ attribute.Key("message.type").String("SENT"), attribute.Key("message.id").Int(1), - attribute.Key("message.uncompressed_size").Int(26), }, span.Events()[1].Attributes) } From 86c38797b1a656c2345b30aabb250a0a3c8b87ff Mon Sep 17 00:00:00 2001 From: Anthony J Mirabella Date: Wed, 18 Jan 2023 18:16:26 -0500 Subject: [PATCH 2/2] mod tidy Signed-off-by: Anthony J Mirabella --- instrumentation/google.golang.org/grpc/otelgrpc/test/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/test/go.mod b/instrumentation/google.golang.org/grpc/otelgrpc/test/go.mod index eb53793d93c..19f5e0fdfba 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/test/go.mod +++ b/instrumentation/google.golang.org/grpc/otelgrpc/test/go.mod @@ -10,7 +10,6 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.34.0 go.uber.org/goleak v1.2.0 google.golang.org/grpc v1.52.0 - google.golang.org/protobuf v1.28.1 ) require ( @@ -30,6 +29,7 @@ require ( golang.org/x/text v0.5.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect + google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect )