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

Send controller/cgroup path telemetry #3231

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions azurelinuxagent/ga/cgroupapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,9 @@ def log_root_paths(self):
for controller in CgroupV1.get_supported_controller_names():
mount_point = self._cgroup_mountpoints.get(controller)
if mount_point is None:
log_cgroup_info("The {0} controller is not mounted".format(controller), send_event=False)
log_cgroup_info("The {0} controller is not mounted".format(controller))
else:
log_cgroup_info("The {0} controller is mounted at {1}".format(controller, mount_point), send_event=False)
log_cgroup_info("The {0} controller is mounted at {1}".format(controller, mount_point))

def start_extension_command(self, extension_name, command, cmd_name, timeout, shell, cwd, env, stdout, stderr,
error_code=ExtensionErrorCodes.PluginUnknownFailure):
Expand Down Expand Up @@ -546,12 +546,12 @@ def get_process_cgroup(self, process_id, cgroup_name):
return CgroupV2(cgroup_name=cgroup_name, root_cgroup_path=self._root_cgroup_path, cgroup_path=cgroup_path, enabled_controllers=self._controllers_enabled_at_root)

def log_root_paths(self):
log_cgroup_info("The root cgroup path is {0}".format(self._root_cgroup_path), send_event=False)
log_cgroup_info("The root cgroup path is {0}".format(self._root_cgroup_path))
for controller in CgroupV2.get_supported_controller_names():
if controller in self._controllers_enabled_at_root:
log_cgroup_info("The {0} controller is enabled at the root cgroup".format(controller), send_event=False)
log_cgroup_info("The {0} controller is enabled at the root cgroup".format(controller))
else:
log_cgroup_info("The {0} controller is not enabled at the root cgroup".format(controller), send_event=False)
log_cgroup_info("The {0} controller is not enabled at the root cgroup".format(controller))

def start_extension_command(self, extension_name, command, cmd_name, timeout, shell, cwd, env, stdout, stderr,
error_code=ExtensionErrorCodes.PluginUnknownFailure):
Expand Down Expand Up @@ -630,17 +630,18 @@ def get_controllers(self, expected_relative_path=None):
controller_mountpoint = self._controller_mountpoints.get(supported_controller_name)

if controller_mountpoint is None:
# Do not send telemetry here. We already have telemetry for unmounted controllers in cgroup init
log_cgroup_warning("{0} controller is not mounted; will not track".format(supported_controller_name), send_event=False)
continue

if controller_path is None:
log_cgroup_warning("{0} is not mounted for the {1} cgroup; will not track".format(supported_controller_name, self._cgroup_name), send_event=False)
log_cgroup_warning("{0} is not mounted for the {1} cgroup; will not track".format(supported_controller_name, self._cgroup_name))
continue

if expected_relative_path is not None:
expected_path = os.path.join(controller_mountpoint, expected_relative_path)
if controller_path != expected_path:
log_cgroup_warning("The {0} controller is not mounted at the expected path for the {1} cgroup; will not track. Actual cgroup path:[{2}] Expected:[{3}]".format(supported_controller_name, self._cgroup_name, controller_path, expected_path), send_event=False)
log_cgroup_warning("The {0} controller is not mounted at the expected path for the {1} cgroup; will not track. Actual cgroup path:[{2}] Expected:[{3}]".format(supported_controller_name, self._cgroup_name, controller_path, expected_path))
continue

if supported_controller_name == self.CPU_CONTROLLER:
Expand All @@ -650,7 +651,7 @@ def get_controllers(self, expected_relative_path=None):

if controller is not None:
msg = "{0} controller for cgroup: {1}".format(supported_controller_name, controller)
log_cgroup_info(msg, send_event=False)
log_cgroup_info(msg)
controllers.append(controller)

return controllers
Expand Down Expand Up @@ -705,21 +706,21 @@ def get_controllers(self, expected_relative_path=None):
controller = None

if supported_controller_name not in self._enabled_controllers:
# Do not send telemetry here. We already have telemetry for disabled controllers in cgroup init
log_cgroup_warning("{0} controller is not enabled; will not track".format(supported_controller_name),
send_event=False)
continue

if self._cgroup_path == "":
log_cgroup_warning("Cgroup path for {0} cannot be determined; will not track".format(self._cgroup_name),
send_event=False)
log_cgroup_warning("Cgroup path for {0} cannot be determined; will not track".format(self._cgroup_name))
continue

if expected_relative_path is not None:
expected_path = os.path.join(self._root_cgroup_path, expected_relative_path)
if self._cgroup_path != expected_path:
log_cgroup_warning(
"The {0} cgroup is not mounted at the expected path; will not track. Actual cgroup path:[{1}] Expected:[{2}]".format(
self._cgroup_name, self._cgroup_path, expected_path), send_event=False)
self._cgroup_name, self._cgroup_path, expected_path))
continue

if supported_controller_name == self.CPU_CONTROLLER:
Expand All @@ -729,7 +730,7 @@ def get_controllers(self, expected_relative_path=None):

if controller is not None:
msg = "{0} controller for cgroup: {1}".format(supported_controller_name, controller)
log_cgroup_info(msg, send_event=False)
log_cgroup_info(msg)
controllers.append(controller)

return controllers
Expand Down
Loading