-
Notifications
You must be signed in to change notification settings - Fork 372
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
Report processes that do not belong to the agent's cgroup #1908
Conversation
def get_monitor_handler(): | ||
return MonitorHandler() | ||
|
||
|
||
class PollResourceUsageOperation(PeriodicOperation): |
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.
moved the periodic tasks into their own classes, which can be used/tested independently of the monitor thread
PeriodicOperation("collect_and_send_events", self.collect_and_send_events, self.EVENT_COLLECTION_PERIOD), | ||
PeriodicOperation("send_telemetry_heartbeat", self.send_telemetry_heartbeat, self.TELEMETRY_HEARTBEAT_PERIOD), | ||
PeriodicOperation("poll_telemetry_metrics usage", self.poll_telemetry_metrics, self.CGROUP_TELEMETRY_POLLING_PERIOD), | ||
ReportNetworkErrorsOperation(), |
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 left these 3 operations in the monitor class because I still need to unravel their dependency on the protocol
Codecov Report
@@ Coverage Diff @@
## develop #1908 +/- ##
===========================================
+ Coverage 69.38% 69.49% +0.10%
===========================================
Files 85 85
Lines 11813 11865 +52
Branches 1658 1666 +8
===========================================
+ Hits 8197 8246 +49
- Misses 3248 3249 +1
- Partials 368 370 +2
Continue to review full report at Codecov.
|
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
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 with minor comments
azurelinuxagent/common/cgroup.py
Outdated
|
||
class MetricsCategory(object): | ||
MEMORY_CATEGORY = "Memory" | ||
PROCESS_CATEGORY = "Process" |
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.
Isn't a better name CPU
? This metric contains CPU counters, right?
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 moved that code from elsewhere, but CPU does make more sense. We are not using the existing metric in kusto so I'll go ahead with the rename.
@@ -1,3 +1,4 @@ | |||
# -*- coding: utf-8 -*- |
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.
Why is this needed?
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.
Ah, because of this?
├─27519 /usr/bin/python3 -u /usr/sbin/waagent -daemon
└─27547 python3 -u bin/WALinuxAgent-2.2.48.1-py2.7.egg -run-exthandlers
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.
yup
@@ -130,6 +127,21 @@ def raise_exception(*_): | |||
message = args[0] | |||
self.assertIn("A TEST EXCEPTION", message) | |||
|
|||
def test_get_processes_in_agent_cgroup_should_return_the_processes_within_the_agent_cgroup(self): |
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.
How is this test different from test_get_processes_in_cgroup_should_return_the_processes_within_the_cgroup
in test_cgroupapi.py
?
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.
code-wise they are the same, but test 2 different components (configurator vs api)
As part of collecting resource usage metrics we now report processes that should not be in the agent's cgroup.