-
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
Add telemetry for azure slice and custom agent unit files #2150
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #2150 +/- ##
===========================================
- Coverage 70.66% 70.50% -0.16%
===========================================
Files 95 95
Lines 12993 13062 +69
Branches 1850 1859 +9
===========================================
+ Hits 9181 9209 +28
- Misses 3401 3437 +36
- Partials 411 416 +5
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.
some minor comments
match = re.match(r'\s?(azure[^\s]*)\s?', line, re.IGNORECASE) | ||
if match is not None: | ||
azure_unit_name = match.group(1) | ||
azure_unit_description = line |
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.
Shouldn't you break once you find your first match? Or maybe capture all the possible options (and make azure_unit_name
an array instead?)
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.
good point; i'll make it handle multiple instances (if any)
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.
done
for unit_file in agent_unit_files: | ||
try: | ||
with open(unit_file, "r") as file_object: | ||
message = "Found a custom unit file for the agent: {0}\n{1}".format(unit_file, file_object.read()) |
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 is very cool and much needed! This would give us a very good idea on how many VMs/Customers are modifying us without us knowing!
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.
yes, it should be helpful. sample logging:
2021-01-27T00:51:34.078443Z INFO ExtHandler ExtHandler Found an Azure unit under -.slice: azure.slice loaded active active Slice for Azure VM Agent and Extensions
2021-01-27T00:51:34.091817Z INFO ExtHandler ExtHandler Found a custom unit file for the agent: /etc/systemd/system/walinuxagent.service
#
# NOTE:
# This file hosted on WALinuxAgent repository only for reference purposes.
# Please refer to a recent image to find out the up-to-date systemd unit file.
#
[Unit]
Description=Azure Linux Agent
After=network-online.target cloud-init.service
Wants=network-online.target sshd.service sshd-keygen.service
ConditionFileIsExecutable=/usr/sbin/waagent
ConditionPathExists=/etc/waagent.conf
[Service]
Type=simple
ExecStart=/usr/bin/python3 -u /usr/sbin/waagent -daemon
Restart=always
[Install]
WantedBy=multi-user.target
2021-01-27T00:51:34.092579Z INFO ExtHandler ExtHandler Found a custom unit file for the agent: /etc/systemd/system/walinuxagent.service.d/10-azure-walinuxagent.system.conf
[Service]
Slice=azure.slice
CPUAccounting=yes
2021-01-27T00:51:34.093055Z INFO ExtHandler ExtHandler Found a custom unit file for the agent: /etc/systemd/system/walinuxagent.service.d/20-azure-walinuxagent.system.conf
[Service]
Slice=azure.slice
MemoryAccounting=yes
Send telemetry if there are units named "azure*" and if there are unit files that override the default agent settings