-
Notifications
You must be signed in to change notification settings - Fork 79
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
Correctly handle status compression on the server side #105
Correctly handle status compression on the server side #105
Conversation
Codecov Report
@@ Coverage Diff @@
## main #105 +/- ##
==========================================
+ Coverage 74.95% 75.13% +0.18%
==========================================
Files 22 22
Lines 1633 1629 -4
==========================================
Hits 1224 1224
+ Misses 307 304 -3
+ Partials 102 101 -1
Continue to review full report at Codecov.
|
This needs to be rebased after #110 is merged and then it can be reviewed. |
e1dbe01
to
a74a86d
Compare
msg.Capabilities |= protobufs.AgentCapabilities_AcceptsPackages | ||
msg.Capabilities |= protobufs.AgentCapabilities_ReportsPackageStatuses | ||
} | ||
msg.Capabilities = c.Capabilities |
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 ensures that the agent correctly reports the capabilities. I can extract this fix into a separate PR, but probably not worth it since it only became visible in this PR.
We check the omitted field and the corresponding capability bit to understand if the compression was used. Related to spec issue open-telemetry/opamp-spec#109 The issue was discarded in favour of the implementation that does not change the spec, but instead uses already existing information.
a74a86d
to
0c16eea
Compare
@andykellr this is now ready for review. |
// True if the status was not fully reported. | ||
statusIsCompressed := effectiveConfigOmitted || packageStatusesOmitted || remoteConfigStatusOmitted || healthOmitted | ||
|
||
if statusIsCompressed && lostPreviousUpdate { |
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.
Should it be OR?
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.
No, "AND" is correct here. We only ned to ask for the full state if both of these conditions are true:
- The full state was not reported in the message we have just received. If this is not true, it means we have already just received the full state, there is no need to ask for it again.
- We detected that we lost a previous update. If this is not true, it means we already have the correct state on our end, there is no need to ask the client to send it again.
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.
Got it, thanks!
We check the omitted field and the corresponding capability bit to understand
if the compression was used.
Related to spec issue open-telemetry/opamp-spec#109
The issue was discarded in favour of the implementation that does not
change the spec, but instead uses already existing information.