Skip to content

Commit

Permalink
fix: add keep alive params to grpc server (#1858)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamirdavid1 authored Nov 26, 2024
1 parent a7a7dfa commit 0ae9144
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions common/config/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/goccy/go-yaml"
"github.com/odigos-io/odigos/common"
"github.com/odigos-io/odigos/common/consts"
)

const (
Expand Down Expand Up @@ -151,6 +152,13 @@ func getBasicConfig(memoryLimiterConfig GenericMap) (*Config, []string) {
// setting it to a large value to avoid dropping batches.
"max_recv_msg_size_mib": 128,
"endpoint": "0.0.0.0:4317",
// The Node Collector opens a gRPC stream to send data. This ensures that the Node Collector establishes a new connection when the Gateway scales up to include additional instances.
"keepalive": GenericMap{
"server_parameters": GenericMap{
"max_connection_age": consts.GatewayMaxConnectionAge,
"max_connection_age_grace": consts.GatewayMaxConnectionAgeGrace,
},
},
},
// Node collectors send in gRPC, so this is probably not needed
"http": GenericMap{
Expand Down
4 changes: 4 additions & 0 deletions common/config/testdata/debugexporter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ receivers:
protocols:
grpc:
endpoint: 0.0.0.0:4317
keepalive:
server_parameters:
max_connection_age: 15s
max_connection_age_grace: 2s
max_recv_msg_size_mib: 128
http:
endpoint: 0.0.0.0:4318
Expand Down
4 changes: 4 additions & 0 deletions common/config/testdata/minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ receivers:
protocols:
grpc:
endpoint: 0.0.0.0:4317
keepalive:
server_parameters:
max_connection_age: 15s
max_connection_age_grace: 2s
max_recv_msg_size_mib: 128
http:
endpoint: 0.0.0.0:4318
Expand Down
4 changes: 4 additions & 0 deletions common/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ const (
InstrumentationDisabled = "disabled"
OdigosReportedNameAnnotation = "odigos.io/reported-name"

// GatewayMaxConnectionAge and GatewayMaxConnectionAgeGrace are the default values for the gateway collector.
GatewayMaxConnectionAge = "15s"
GatewayMaxConnectionAgeGrace = "2s"

// Used to store the original value of the environment variable in the pod manifest.
// This is used to restore the original value when an instrumentation is removed
// or odigos is uninstalled.
Expand Down

0 comments on commit 0ae9144

Please sign in to comment.