From 6ad6b868161095d5f5292839a2a2edfa1792d591 Mon Sep 17 00:00:00 2001 From: Tania Pham Date: Tue, 2 Jul 2024 10:47:09 -0700 Subject: [PATCH] Change default otlp exporter GRPC load balancer to round robin (#10319) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### Description Updates the default `pick_first` load balancer to `round_robin`, which allows for better resource allocation and less chances of throttling data being sent to addresses. #### Link to tracking issue Fixes #10298 (has full context of this PR) #### Testing Edited tests to allow round_robin load balancing. --------- Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com> Co-authored-by: Juraci Paixão Kröhling --- .chloggen/load-balancer-round-robin.yaml | 24 ++++++++++++++++++++++++ config/configgrpc/README.md | 4 ++-- config/configgrpc/configgrpc.go | 12 +++++++++--- config/configgrpc/configgrpc_test.go | 9 +++++---- 4 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 .chloggen/load-balancer-round-robin.yaml diff --git a/.chloggen/load-balancer-round-robin.yaml b/.chloggen/load-balancer-round-robin.yaml new file mode 100644 index 00000000000..1b9a711b7de --- /dev/null +++ b/.chloggen/load-balancer-round-robin.yaml @@ -0,0 +1,24 @@ +# Use this changelog template to create an entry for release notes. + +# 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: configgrpc + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Update the default load balancer strategy to round_robin + +# One or more tracking issues or pull requests related to the change +issues: [10319] + +# (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: To restore the behavior that was previously the default, set `balancer_name` to `pick_first`. + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +change_logs: [user] \ No newline at end of file diff --git a/config/configgrpc/README.md b/config/configgrpc/README.md index b9cf2f01be2..e0db0421e7e 100644 --- a/config/configgrpc/README.md +++ b/config/configgrpc/README.md @@ -15,8 +15,8 @@ configuration parameters are also defined under `tls` like server configuration. For more information, see [configtls README](../configtls/README.md). -- [`balancer_name`](https://github.com/grpc/grpc-go/blob/master/examples/features/load_balancing/README.md) -- `compression` Compression type to use among `gzip`, `snappy`, `zstd`, and `none`. +- [`balancer_name`](https://github.com/grpc/grpc-go/blob/master/examples/features/load_balancing/README.md): Default before v0.103.0 is `pick_first`, default for v0.103.0 is `round_robin`. See [issue](https://github.com/open-telemetry/opentelemetry-collector/issues/10298). To restore the previous behavior, set `balancer_name` to `pick_first`. +- `compression`: Compression type to use among `gzip`, `snappy`, `zstd`, and `none`. - `endpoint`: Valid value syntax available [here](https://github.com/grpc/grpc/blob/master/doc/naming.md) - [`tls`](../configtls/README.md) - `headers`: name/value pairs added to the request diff --git a/config/configgrpc/configgrpc.go b/config/configgrpc/configgrpc.go index 87e7b83d766..73176c9dec9 100644 --- a/config/configgrpc/configgrpc.go +++ b/config/configgrpc/configgrpc.go @@ -55,6 +55,11 @@ func NewDefaultKeepaliveClientConfig() *KeepaliveClientConfig { } } +// BalancerName returns a string with default load balancer value +func BalancerName() string { + return "round_robin" +} + // ClientConfig defines common settings for a gRPC client configuration. type ClientConfig struct { // The target to which the exporter is going to send traces or metrics, @@ -102,9 +107,10 @@ type ClientConfig struct { // NewDefaultClientConfig returns a new instance of ClientConfig with default values. func NewDefaultClientConfig() *ClientConfig { return &ClientConfig{ - TLSSetting: configtls.NewDefaultClientConfig(), - Keepalive: NewDefaultKeepaliveClientConfig(), - Auth: configauth.NewDefaultAuthentication(), + TLSSetting: configtls.NewDefaultClientConfig(), + Keepalive: NewDefaultKeepaliveClientConfig(), + Auth: configauth.NewDefaultAuthentication(), + BalancerName: BalancerName(), } } diff --git a/config/configgrpc/configgrpc_test.go b/config/configgrpc/configgrpc_test.go index 010c415a441..0b2b1cf4cd2 100644 --- a/config/configgrpc/configgrpc_test.go +++ b/config/configgrpc/configgrpc_test.go @@ -48,9 +48,10 @@ func TestNewDefaultKeepaliveClientConfig(t *testing.T) { func TestNewDefaultClientConfig(t *testing.T) { expected := &ClientConfig{ - TLSSetting: configtls.NewDefaultClientConfig(), - Keepalive: NewDefaultKeepaliveClientConfig(), - Auth: configauth.NewDefaultAuthentication(), + TLSSetting: configtls.NewDefaultClientConfig(), + Keepalive: NewDefaultKeepaliveClientConfig(), + Auth: configauth.NewDefaultAuthentication(), + BalancerName: BalancerName(), } result := NewDefaultClientConfig() @@ -215,7 +216,7 @@ func TestAllGrpcClientSettings(t *testing.T) { ReadBufferSize: 1024, WriteBufferSize: 1024, WaitForReady: true, - BalancerName: "configgrpc_balancer_test", + BalancerName: "round_robin", Authority: "pseudo-authority", Auth: &configauth.Authentication{AuthenticatorID: testAuthID}, },