-
Notifications
You must be signed in to change notification settings - Fork 73
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
feat(agent): configure retry strategy #3317
Conversation
agent/initialization/start.go
Outdated
@@ -17,52 +17,52 @@ import ( | |||
var ErrOtlpServerStart = errors.New("OTLP server start error") | |||
|
|||
func NewClient(ctx context.Context, config config.Config, traceCache collector.TraceCache) (*client.Client, error) { | |||
client, err := client.Connect(ctx, config.ServerURL, | |||
c, err := client.Connect(ctx, config.ServerURL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are you renaming it to c
? why not leave it as client
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was leftover from a previous attempt, but using client
as the name overrides the client
package import, and it's not a great practice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be ok with c
if it was an anchor variable. But as we use it for some config, I would like a more meaningful name like grpcClient
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we use a verbose name that specifies what this client is? Something like tracetestClient
or controlPlaneClient
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated to controlPlaneClient
, feels like the most meaningful to me
This PR configures the gRPC client retry strategy to allow better handling of connection issues. In the case of connection interruption between the server and the agent for whatever reason (server restarted, networking issues, etc), the client will retry the operation using an exponential backoff strategy. With the currently configured values, this is the retry timeline:
If the operation was not succesful after the last attempt, it will fail, causing the agent to exit with an erro message.
This behaviour is specially useful on docker/k8s environments, since it kills the container and makes the orchestrator restart it, allowing the process to be restarted until a succesful connection is established