Skip to content

Commit 6ad6b86

Browse files
taniyourstrulycodebotenjpkrohling
authored
Change default otlp exporter GRPC load balancer to round robin (#10319)
#### 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 <[email protected]> Co-authored-by: Juraci Paixão Kröhling <[email protected]>
1 parent 428d3f8 commit 6ad6b86

File tree

4 files changed

+40
-9
lines changed

4 files changed

+40
-9
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
7+
component: configgrpc
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Update the default load balancer strategy to round_robin
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [10319]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext: To restore the behavior that was previously the default, set `balancer_name` to `pick_first`.
19+
20+
# Optional: The change log or logs in which this entry should be included.
21+
# e.g. '[user]' or '[user, api]'
22+
# Include 'user' if the change is relevant to end users.
23+
# Include 'api' if there is a change to a library API.
24+
change_logs: [user]

config/configgrpc/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ configuration parameters are also defined under `tls` like server
1515
configuration. For more information, see [configtls
1616
README](../configtls/README.md).
1717

18-
- [`balancer_name`](https://github.com/grpc/grpc-go/blob/master/examples/features/load_balancing/README.md)
19-
- `compression` Compression type to use among `gzip`, `snappy`, `zstd`, and `none`.
18+
- [`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`.
19+
- `compression`: Compression type to use among `gzip`, `snappy`, `zstd`, and `none`.
2020
- `endpoint`: Valid value syntax available [here](https://github.com/grpc/grpc/blob/master/doc/naming.md)
2121
- [`tls`](../configtls/README.md)
2222
- `headers`: name/value pairs added to the request

config/configgrpc/configgrpc.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ func NewDefaultKeepaliveClientConfig() *KeepaliveClientConfig {
5555
}
5656
}
5757

58+
// BalancerName returns a string with default load balancer value
59+
func BalancerName() string {
60+
return "round_robin"
61+
}
62+
5863
// ClientConfig defines common settings for a gRPC client configuration.
5964
type ClientConfig struct {
6065
// The target to which the exporter is going to send traces or metrics,
@@ -102,9 +107,10 @@ type ClientConfig struct {
102107
// NewDefaultClientConfig returns a new instance of ClientConfig with default values.
103108
func NewDefaultClientConfig() *ClientConfig {
104109
return &ClientConfig{
105-
TLSSetting: configtls.NewDefaultClientConfig(),
106-
Keepalive: NewDefaultKeepaliveClientConfig(),
107-
Auth: configauth.NewDefaultAuthentication(),
110+
TLSSetting: configtls.NewDefaultClientConfig(),
111+
Keepalive: NewDefaultKeepaliveClientConfig(),
112+
Auth: configauth.NewDefaultAuthentication(),
113+
BalancerName: BalancerName(),
108114
}
109115
}
110116

config/configgrpc/configgrpc_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ func TestNewDefaultKeepaliveClientConfig(t *testing.T) {
4848

4949
func TestNewDefaultClientConfig(t *testing.T) {
5050
expected := &ClientConfig{
51-
TLSSetting: configtls.NewDefaultClientConfig(),
52-
Keepalive: NewDefaultKeepaliveClientConfig(),
53-
Auth: configauth.NewDefaultAuthentication(),
51+
TLSSetting: configtls.NewDefaultClientConfig(),
52+
Keepalive: NewDefaultKeepaliveClientConfig(),
53+
Auth: configauth.NewDefaultAuthentication(),
54+
BalancerName: BalancerName(),
5455
}
5556

5657
result := NewDefaultClientConfig()
@@ -215,7 +216,7 @@ func TestAllGrpcClientSettings(t *testing.T) {
215216
ReadBufferSize: 1024,
216217
WriteBufferSize: 1024,
217218
WaitForReady: true,
218-
BalancerName: "configgrpc_balancer_test",
219+
BalancerName: "round_robin",
219220
Authority: "pseudo-authority",
220221
Auth: &configauth.Authentication{AuthenticatorID: testAuthID},
221222
},

0 commit comments

Comments
 (0)