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

Add API for uploading logs via host plugin #1902

Merged
merged 10 commits into from
Aug 4, 2020
Merged

Conversation

pgombar
Copy link
Contributor

@pgombar pgombar commented Jun 4, 2020

Description

Continuation of the work started in #1847. These changes update the wire client, wire protocol and host plugin with an API for uploading logs.


PR information

  • The title of the PR is clear and informative.
  • There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
  • Except for special cases involving multiple contributors, the PR is started from a fork of the main repository, not a branch.
  • If applicable, the PR references the bug/issue that it fixes in the description.
  • New Unit tests were added for the changes made and Travis.CI is passing.

Quality of Code and Contribution Guidelines

@codecov
Copy link

codecov bot commented Jun 4, 2020

Codecov Report

Merging #1902 into develop will increase coverage by 0.04%.
The diff coverage is 89.83%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1902      +/-   ##
===========================================
+ Coverage    69.59%   69.63%   +0.04%     
===========================================
  Files           85       85              
  Lines        11993    12024      +31     
  Branches      1676     1680       +4     
===========================================
+ Hits          8346     8373      +27     
- Misses        3273     3275       +2     
- Partials       374      376       +2     
Impacted Files Coverage Δ
azurelinuxagent/common/protocol/hostplugin.py 84.05% <85.29%> (+0.18%) ⬆️
azurelinuxagent/common/protocol/wire.py 76.73% <96.00%> (+0.16%) ⬆️

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 0991c3a...5ac72c2. Read the comment docs.

Copy link
Contributor

@larohra larohra left a comment

Choose a reason for hiding this comment

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

left some comments

tests/data/wire/goal_state.xml Show resolved Hide resolved
azurelinuxagent/common/protocol/hostplugin.py Show resolved Hide resolved
tests/protocol/test_hostplugin.py Outdated Show resolved Hide resolved
Copy link
Member

@narrieta narrieta left a comment

Choose a reason for hiding this comment

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

left some comments; thanks for the improvements in mock_wire_protocol, etc

raise NotImplementedError("Unimplemented")
"""
Try to upload VM logs, a compressed zip file, via the host plugin /vmAgentLog channel.
:param content: the binary content of the zip file to upload
Copy link
Member

Choose a reason for hiding this comment

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

wow, so the host ga plugin requires to load the whole file to memory? what is the max size of the zip, again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't figured out a way to not load it. Everything we send using restutil loads the object in-memory. The restriction on the agent side for the uncompressed archive is 150 MB (from my testing on actual log data, this will result in a compressed archive of 13-15 MB). On the host, the restriction is 100 MB.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we plan on adding resource limiters to this process/thread, can that potentially break/delay uploading the logs to Host?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In theory, it could. However, from the memory point of view, all this is adding is an overhead of ~15 MB (worst case scenario) every hour. Disk I/O could be a bigger problem, but we don't have any plans for limiting that in the near future.

larohra
larohra previously approved these changes Jul 23, 2020
Copy link
Contributor

@larohra larohra left a comment

Choose a reason for hiding this comment

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

Small comments

tests/common/test_event.py Show resolved Hide resolved
raise NotImplementedError("Unimplemented")
"""
Try to upload VM logs, a compressed zip file, via the host plugin /vmAgentLog channel.
:param content: the binary content of the zip file to upload
Copy link
Contributor

Choose a reason for hiding this comment

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

If we plan on adding resource limiters to this process/thread, can that potentially break/delay uploading the logs to Host?

narrieta
narrieta previously approved these changes Jul 31, 2020
Copy link
Member

@narrieta narrieta left a comment

Choose a reason for hiding this comment

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

LGTM, with a minor comment

@pgombar pgombar dismissed stale reviews from narrieta and larohra via 5ac72c2 August 4, 2020 22:50
@pgombar pgombar merged commit d949a7a into Azure:develop Aug 4, 2020
@pgombar pgombar deleted the log_upload branch August 4, 2020 23:01
@pgombar pgombar mentioned this pull request Aug 20, 2020
6 tasks
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