Skip to content
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

Client should send status report on reconnect #55

Closed
andykellr opened this issue Mar 4, 2022 · 3 comments · Fixed by #63
Closed

Client should send status report on reconnect #55

andykellr opened this issue Mar 4, 2022 · 3 comments · Fixed by #63

Comments

@andykellr
Copy link
Contributor

andykellr commented Mar 4, 2022

Currently, the status report message is prepared here in client.Start:

// Prepare the first status report.
w.sender.UpdateNextStatus(
func(statusReport *protobufs.StatusReport) {
statusReport.AgentDescription = w.settings.AgentDescription
},

It then begins runUntilStopped and in runOneCycle it ensures it is connected before entering the ReceiverLoop to receive massages from the server:

func (w *client) runOneCycle(ctx context.Context) {
if err := w.ensureConnected(ctx); err != nil {
// Can't connect, so can't move forward. This currently happens when we
// are being stopped.
return
}

If the connection is closed, it will repeat runOneCycle and reconnect, but after reconnection no status message is sent because no message has been prepared.

In our own agent, the workaround was to call SetAgentDescription in the OnConnect callback, but I think the implementation should be doing this automatically.

@andykellr
Copy link
Contributor Author

Here is the section of the spec regarding the agent sending a status report upon connection. I doesn't specifically address reconnecting, but I think this is implied.

https://github.com/open-telemetry/opamp-spec/blob/410dc86792d6109050e767a1d76de12a5b9f0129/specification.md?plain=1#L485-L491

@tigrannajaryan
Copy link
Member

Here is the section of the spec regarding the agent sending a status report upon connection. I doesn't specifically address reconnecting, but I think this is implied.

@andykellr you are right. The status report should be sent after reconnecting. Will you be able to submit a PR with a fix?

@dsvanlani
Copy link
Contributor

@tigrannajaryan I'm working on a PR for this, but will not have anything to show by this afternoons work group.

tigrannajaryan pushed a commit that referenced this issue Apr 13, 2022
Resolves: #55

This PR ensures that the client includes AgentDescription every time it connects to the server, not just after `client.Start`.

Current behavior:
- Clients connection to server is interrupted.
- Client reconnects.
- Client does not prepare a "first status message" with an `AgentDescription`.

Expected behavior:
- Clients connection to server is interrupted.
- Client reconnects.
- Client prepares and sends a status including AgentDescription.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants