Skip to content

Commit

Permalink
Upgrade github.com/mostynb/go-grpc-compression and switch to nonclobb…
Browse files Browse the repository at this point in the history
…ering imports (#7966)

**Description:** Switch to grpc encoders that won't override the
consumer's previously registered codecs.

Some consumers of this library have registered grpc compressors, and the
init() order can cause their compressors to be clobbered by
opentelemetry-collector's use of github.com/mostynb/go-grpc-compression,
which follows the pattern from the grpc-go library (overwrite any
previously registered encoders with the same name).

Version 1.2.0 of github.com/mostynb/go-grpc-compression added so-called
"nonclobbering" imports, which only register the codec if there is not
already a codec registered with that name. This PR switches to use
those.

**Link to tracking Issue:** #7920

**Testing:** tests have been added to the upstream library.
  • Loading branch information
mostynb authored Jun 29, 2023
1 parent c3f70bd commit f990e99
Show file tree
Hide file tree
Showing 21 changed files with 334 additions and 4 deletions.
16 changes: 16 additions & 0 deletions .chloggen/nonclobbering_go_grpc_compression.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: otlpreceiver, otlphttpexporter, otlpexporter, configgrpc

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Upgrade github.com/mostynb/go-grpc-compression and switch to nonclobbering imports

# One or more tracking issues or pull requests related to the change
issues: [7920]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: consumers of this library should not have their grpc codecs overridden
4 changes: 2 additions & 2 deletions config/configgrpc/configgrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"strings"
"time"

"github.com/mostynb/go-grpc-compression/snappy"
"github.com/mostynb/go-grpc-compression/zstd"
"github.com/mostynb/go-grpc-compression/nonclobbering/snappy"
"github.com/mostynb/go-grpc-compression/nonclobbering/zstd"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
"go.opentelemetry.io/otel"
"google.golang.org/grpc"
Expand Down
4 changes: 2 additions & 2 deletions config/configgrpc/configgrpc_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"fmt"
"testing"

"github.com/mostynb/go-grpc-compression/snappy"
"github.com/mostynb/go-grpc-compression/zstd"
"github.com/mostynb/go-grpc-compression/nonclobbering/snappy"
"github.com/mostynb/go-grpc-compression/nonclobbering/zstd"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/encoding"
"google.golang.org/grpc/encoding/gzip"
Expand Down
6 changes: 6 additions & 0 deletions config/configgrpc/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,9 @@ replace go.opentelemetry.io/collector/component => ../../component
replace go.opentelemetry.io/collector/semconv => ../../semconv

replace go.opentelemetry.io/collector/consumer => ../../consumer

replace go.opentelemetry.io/collector/processor/memorylimiterprocessor => ../../processor/memorylimiterprocessor

replace go.opentelemetry.io/collector/config/confighttp => ../confighttp

replace go.opentelemetry.io/collector/receiver/otlpreceiver => ../../receiver/otlpreceiver
6 changes: 6 additions & 0 deletions config/confighttp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,9 @@ replace go.opentelemetry.io/collector/component => ../../component
replace go.opentelemetry.io/collector/semconv => ../../semconv

replace go.opentelemetry.io/collector/consumer => ../../consumer

replace go.opentelemetry.io/collector/processor/memorylimiterprocessor => ../../processor/memorylimiterprocessor

replace go.opentelemetry.io/collector/config/configgrpc => ../configgrpc

replace go.opentelemetry.io/collector/receiver/otlpreceiver => ../../receiver/otlpreceiver
20 changes: 20 additions & 0 deletions connector/forwardconnector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,23 @@ retract (
replace go.opentelemetry.io/collector/config/confignet => ../../config/confignet

replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry

replace go.opentelemetry.io/collector/receiver/otlpreceiver => ../../receiver/otlpreceiver

replace go.opentelemetry.io/collector/config/configgrpc => ../../config/configgrpc

replace go.opentelemetry.io/collector/config/configauth => ../../config/configauth

replace go.opentelemetry.io/collector/config/internal => ../../config/internal

replace go.opentelemetry.io/collector/config/configtls => ../../config/configtls

replace go.opentelemetry.io/collector/extension/auth => ../../extension/auth

replace go.opentelemetry.io/collector/config/configopaque => ../../config/configopaque

replace go.opentelemetry.io/collector/config/configcompression => ../../config/configcompression

replace go.opentelemetry.io/collector/processor/memorylimiterprocessor => ../../processor/memorylimiterprocessor

replace go.opentelemetry.io/collector/config/confighttp => ../../config/confighttp
20 changes: 20 additions & 0 deletions connector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,23 @@ replace go.opentelemetry.io/collector/semconv => ../semconv
replace go.opentelemetry.io/collector/exporter => ../exporter

replace go.opentelemetry.io/collector/config/confignet => ../config/confignet

replace go.opentelemetry.io/collector/config/confighttp => ../config/confighttp

replace go.opentelemetry.io/collector/extension/auth => ../extension/auth

replace go.opentelemetry.io/collector/config/configopaque => ../config/configopaque

replace go.opentelemetry.io/collector/config/configcompression => ../config/configcompression

replace go.opentelemetry.io/collector/receiver/otlpreceiver => ../receiver/otlpreceiver

replace go.opentelemetry.io/collector/processor/memorylimiterprocessor => ../processor/memorylimiterprocessor

replace go.opentelemetry.io/collector/config/configgrpc => ../config/configgrpc

replace go.opentelemetry.io/collector/config/configauth => ../config/configauth

replace go.opentelemetry.io/collector/config/internal => ../config/internal

replace go.opentelemetry.io/collector/config/configtls => ../config/configtls
20 changes: 20 additions & 0 deletions consumer/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,23 @@ replace go.opentelemetry.io/collector/connector => ../connector
replace go.opentelemetry.io/collector/config/confignet => ../config/confignet

replace go.opentelemetry.io/collector/config/configtelemetry => ../config/configtelemetry

replace go.opentelemetry.io/collector/config/configauth => ../config/configauth

replace go.opentelemetry.io/collector/extension/auth => ../extension/auth

replace go.opentelemetry.io/collector/config/configtls => ../config/configtls

replace go.opentelemetry.io/collector/config/configopaque => ../config/configopaque

replace go.opentelemetry.io/collector/config/configcompression => ../config/configcompression

replace go.opentelemetry.io/collector/receiver/otlpreceiver => ../receiver/otlpreceiver

replace go.opentelemetry.io/collector/processor/memorylimiterprocessor => ../processor/memorylimiterprocessor

replace go.opentelemetry.io/collector/config/confighttp => ../config/confighttp

replace go.opentelemetry.io/collector/config/internal => ../config/internal

replace go.opentelemetry.io/collector/config/configgrpc => ../config/configgrpc
20 changes: 20 additions & 0 deletions exporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,23 @@ replace go.opentelemetry.io/collector/connector => ../connector
replace go.opentelemetry.io/collector/config/confignet => ../config/confignet

replace go.opentelemetry.io/collector/config/configtelemetry => ../config/configtelemetry

replace go.opentelemetry.io/collector/config/configgrpc => ../config/configgrpc

replace go.opentelemetry.io/collector/config/configcompression => ../config/configcompression

replace go.opentelemetry.io/collector/config/configauth => ../config/configauth

replace go.opentelemetry.io/collector/receiver/otlpreceiver => ../receiver/otlpreceiver

replace go.opentelemetry.io/collector/config/confighttp => ../config/confighttp

replace go.opentelemetry.io/collector/processor/memorylimiterprocessor => ../processor/memorylimiterprocessor

replace go.opentelemetry.io/collector/config/configopaque => ../config/configopaque

replace go.opentelemetry.io/collector/extension/auth => ../extension/auth

replace go.opentelemetry.io/collector/config/internal => ../config/internal

replace go.opentelemetry.io/collector/config/configtls => ../config/configtls
20 changes: 20 additions & 0 deletions exporter/loggingexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,23 @@ replace go.opentelemetry.io/collector/connector => ../../connector
replace go.opentelemetry.io/collector/config/confignet => ../../config/confignet

replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry

replace go.opentelemetry.io/collector/config/configcompression => ../../config/configcompression

replace go.opentelemetry.io/collector/config/configtls => ../../config/configtls

replace go.opentelemetry.io/collector/config/configopaque => ../../config/configopaque

replace go.opentelemetry.io/collector/config/internal => ../../config/internal

replace go.opentelemetry.io/collector/receiver/otlpreceiver => ../../receiver/otlpreceiver

replace go.opentelemetry.io/collector/processor/memorylimiterprocessor => ../../processor/memorylimiterprocessor

replace go.opentelemetry.io/collector/config/confighttp => ../../config/confighttp

replace go.opentelemetry.io/collector/extension/auth => ../../extension/auth

replace go.opentelemetry.io/collector/config/configgrpc => ../../config/configgrpc

replace go.opentelemetry.io/collector/config/configauth => ../../config/configauth
6 changes: 6 additions & 0 deletions exporter/otlpexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,9 @@ retract (
replace go.opentelemetry.io/collector/connector => ../../connector

replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry

replace go.opentelemetry.io/collector/receiver/otlpreceiver => ../../receiver/otlpreceiver

replace go.opentelemetry.io/collector/config/confighttp => ../../config/confighttp

replace go.opentelemetry.io/collector/processor/memorylimiterprocessor => ../../processor/memorylimiterprocessor
2 changes: 2 additions & 0 deletions exporter/otlphttpexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,5 @@ retract (

// ambiguous import: found package cloud.google.com/go/compute/metadata in multiple modules
replace cloud.google.com/go => cloud.google.com/go v0.110.2

replace go.opentelemetry.io/collector/processor/memorylimiterprocessor => ../../processor/memorylimiterprocessor
20 changes: 20 additions & 0 deletions extension/ballastextension/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,23 @@ replace go.opentelemetry.io/collector/connector => ../../connector
replace go.opentelemetry.io/collector/config/confignet => ../../config/confignet

replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry

replace go.opentelemetry.io/collector/config/configgrpc => ../../config/configgrpc

replace go.opentelemetry.io/collector/config/configauth => ../../config/configauth

replace go.opentelemetry.io/collector/processor/memorylimiterprocessor => ../../processor/memorylimiterprocessor

replace go.opentelemetry.io/collector/config/internal => ../../config/internal

replace go.opentelemetry.io/collector/config/configopaque => ../../config/configopaque

replace go.opentelemetry.io/collector/config/configcompression => ../../config/configcompression

replace go.opentelemetry.io/collector/extension/auth => ../auth

replace go.opentelemetry.io/collector/config/configtls => ../../config/configtls

replace go.opentelemetry.io/collector/config/confighttp => ../../config/confighttp

replace go.opentelemetry.io/collector/receiver/otlpreceiver => ../../receiver/otlpreceiver
20 changes: 20 additions & 0 deletions extension/zpagesextension/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,23 @@ retract (
replace go.opentelemetry.io/collector/connector => ../../connector

replace go.opentelemetry.io/collector/config/configtelemetry => ../../config/configtelemetry

replace go.opentelemetry.io/collector/processor/memorylimiterprocessor => ../../processor/memorylimiterprocessor

replace go.opentelemetry.io/collector/config/internal => ../../config/internal

replace go.opentelemetry.io/collector/config/configcompression => ../../config/configcompression

replace go.opentelemetry.io/collector/config/configauth => ../../config/configauth

replace go.opentelemetry.io/collector/config/confighttp => ../../config/confighttp

replace go.opentelemetry.io/collector/config/configgrpc => ../../config/configgrpc

replace go.opentelemetry.io/collector/receiver/otlpreceiver => ../../receiver/otlpreceiver

replace go.opentelemetry.io/collector/config/configtls => ../../config/configtls

replace go.opentelemetry.io/collector/extension/auth => ../auth

replace go.opentelemetry.io/collector/config/configopaque => ../../config/configopaque
38 changes: 38 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/logr v1.2.4 // indirect
Expand All @@ -54,8 +56,10 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.6 // indirect
github.com/knadh/koanf v1.5.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
Expand All @@ -64,15 +68,29 @@ require (
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mostynb/go-grpc-compression v1.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/prometheus/statsd_exporter v0.22.7 // indirect
github.com/rs/cors v1.9.0 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/numcpus v0.6.0 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
go.opentelemetry.io/collector/config/configauth v0.80.0 // indirect
go.opentelemetry.io/collector/config/configcompression v0.80.0 // indirect
go.opentelemetry.io/collector/config/configgrpc v0.80.0 // indirect
go.opentelemetry.io/collector/config/confighttp v0.80.0 // indirect
go.opentelemetry.io/collector/config/configopaque v0.80.0 // indirect
go.opentelemetry.io/collector/config/configtls v0.80.0 // indirect
go.opentelemetry.io/collector/config/internal v0.80.0 // indirect
go.opentelemetry.io/collector/extension/auth v0.80.0 // indirect
go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.80.0 // indirect
go.opentelemetry.io/collector/receiver/otlpreceiver v0.80.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.1-0.20230612162650-64be7e574a17 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 // indirect
go.opentelemetry.io/contrib/zpages v0.42.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
golang.org/x/net v0.11.0 // indirect
Expand Down Expand Up @@ -117,3 +135,23 @@ retract (
v0.57.0 // Release failed, use v0.57.2
v0.32.0 // Contains incomplete metrics transition to proto 0.9.0, random components are not working.
)

replace go.opentelemetry.io/collector/config/internal => ./config/internal

replace go.opentelemetry.io/collector/config/configopaque => ./config/configopaque

replace go.opentelemetry.io/collector/config/confighttp => ./config/confighttp

replace go.opentelemetry.io/collector/config/configauth => ./config/configauth

replace go.opentelemetry.io/collector/config/configtls => ./config/configtls

replace go.opentelemetry.io/collector/processor/memorylimiterprocessor => ./processor/memorylimiterprocessor

replace go.opentelemetry.io/collector/config/configcompression => ./config/configcompression

replace go.opentelemetry.io/collector/receiver/otlpreceiver => ./receiver/otlpreceiver

replace go.opentelemetry.io/collector/extension/auth => ./extension/auth

replace go.opentelemetry.io/collector/config/configgrpc => ./config/configgrpc
Loading

0 comments on commit f990e99

Please sign in to comment.