-
Notifications
You must be signed in to change notification settings - Fork 76
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
Send data plane health request #683
Conversation
✅ Deploy Preview for agent-public-docs canceled.
|
if !gc.isConnected.Load() { | ||
slog.InfoContext(ctx, "gRPC client not connected yet. Skipping sending data plane health update") | ||
return nil | ||
} |
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 is likely out of scope but should we be buffering messages in the event that we aren't connected?
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.
yeah maybe create a separate task for that. We should be retrying until a connection is made
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'm not sure, to be honest I just went off what was done for the data plane status for this.
} | ||
|
||
func (hw *HealthWatcherService) Watch(ctx context.Context, ch chan<- InstanceHealthMessage) { | ||
monitoringFrequency := hw.agentConfig.Watchers.InstanceHealthWatcher.MonitoringFrequency |
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.
security: Add nil checks for agentConfig
and Watchers
. Or at least for Watchers
.
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.
Discussed in office, will be fixed in later PR
} | ||
} | ||
|
||
func (hw *HealthWatcherService) health(ctx context.Context) ([]*v1.InstanceHealth, bool, |
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 generally think that it's a good idea to have named return values if one of them is a bool
, as you can't infer what the bool
means based on the signature alone without them.
func (hw *HealthWatcherService) health(ctx context.Context) ([]*v1.InstanceHealth, bool, | ||
) { | ||
healthStatuses := make([]*v1.InstanceHealth, 0, len(hw.watchers)) | ||
currentHealth := make(map[string]*v1.InstanceHealth) |
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.
nit: I think we can add a size hint for this one?
https://github.com/uber-go/guide/blob/master/style.md#specifying-map-capacity-hints
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.
LGTM!
Proposed changes
Added:
Checklist
Before creating a PR, run through this checklist and mark each as complete.
CONTRIBUTING
documentmake install-tools
and have attached any dependency changes to this pull requestREADME.md
)