Skip to content

Change default otlp exporter GRPC load balancer to round robin #10319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .chloggen/load-balancer-round-robin.yaml
Original file line number Diff line number Diff line change
@@ -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]
4 changes: 2 additions & 2 deletions config/configgrpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions config/configgrpc/configgrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
}
}

Expand Down
9 changes: 5 additions & 4 deletions config/configgrpc/configgrpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,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()
Expand Down Expand Up @@ -213,7 +214,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},
},
Expand Down