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

Correctly handle status compression on the server side #105

Conversation

tigrannajaryan
Copy link
Member

@tigrannajaryan tigrannajaryan commented Jul 15, 2022

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.

@codecov
Copy link

codecov bot commented Jul 15, 2022

Codecov Report

Merging #105 (0c16eea) into main (63c9165) will increase coverage by 0.18%.
The diff coverage is 100.00%.

@@            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     
Impacted Files Coverage Δ
client/internal/clientcommon.go 79.50% <100.00%> (-0.41%) ⬇️
client/wsclient.go 87.03% <0.00%> (+2.46%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 63c9165...0c16eea. Read the comment docs.

@tigrannajaryan
Copy link
Member Author

This needs to be rebased after #110 is merged and then it can be reviewed.

@tigrannajaryan tigrannajaryan force-pushed the feature/tigran/use-capabilities branch 2 times, most recently from e1dbe01 to a74a86d Compare July 22, 2022 19:03
@tigrannajaryan tigrannajaryan marked this pull request as ready for review July 22, 2022 19:04
@tigrannajaryan tigrannajaryan requested a review from a team July 22, 2022 19:04
msg.Capabilities |= protobufs.AgentCapabilities_AcceptsPackages
msg.Capabilities |= protobufs.AgentCapabilities_ReportsPackageStatuses
}
msg.Capabilities = c.Capabilities
Copy link
Member Author

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.
@tigrannajaryan tigrannajaryan force-pushed the feature/tigran/use-capabilities branch from a74a86d to 0c16eea Compare July 22, 2022 19:06
@tigrannajaryan
Copy link
Member Author

@andykellr this is now ready for review.

@tigrannajaryan tigrannajaryan merged commit 3d4cbdc into open-telemetry:main Jul 28, 2022
@tigrannajaryan tigrannajaryan deleted the feature/tigran/use-capabilities branch July 28, 2022 18:56
// True if the status was not fully reported.
statusIsCompressed := effectiveConfigOmitted || packageStatusesOmitted || remoteConfigStatusOmitted || healthOmitted

if statusIsCompressed && lostPreviousUpdate {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be OR?

Copy link
Member Author

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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks!

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 this pull request may close these issues.

3 participants