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

Improve telemetry event for OS info #1698

Merged
merged 2 commits into from
Nov 6, 2019
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion azurelinuxagent/common/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ class WALAEventOperation:
InitializeHostPlugin = "InitializeHostPlugin"
InvokeCommandUsingSystemd = "InvokeCommandUsingSystemd"
Log = "Log"
OSInfo = "OSInfo"
Partition = "Partition"
ProcessGoalState = "ProcessGoalState"
Provision = "Provision"
ProvisionGuestAgent = "ProvisionGuestAgent"
Release43PR1580 = "Release43PR1580"
RemoteAccessHandling = "RemoteAccessHandling"
ReportStatus = "ReportStatus"
ReportStatusExtended = "ReportStatusExtended"
Expand Down
26 changes: 18 additions & 8 deletions azurelinuxagent/ga/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,23 +248,27 @@ def run(self, debug=False):
"""

try:
# NOTE: Do not add any telemetry events until after the monitoring handler has been started with the
# call to 'monitor_thread.run()'. That method call initializes the protocol, which is needed in order to
# load the goal state and update the container id in memory. Any telemetry events sent before this happens
# will result in an uninitialized container id value.

logger.info(u"Agent {0} is running as the goal state agent",
CURRENT_AGENT)

# Log OS-specific info, locally and as a telemetry event.
msg = u"Distro info: {0} {1}, osutil class being used: {2}, " \
u"agent service name: {3}".format(DISTRO_NAME, DISTRO_VERSION,
type(self.osutil).__name__, self.osutil.service_name)
add_event(AGENT_NAME,
op=WALAEventOperation.Release43PR1580,
message=msg)
logger.info(msg)
# Log OS-specific info locally.
os_info_msg = u"Distro info: {0} {1}, osutil class being used: {2}, " \
u"agent service name: {3}".format(DISTRO_NAME, DISTRO_VERSION,
type(self.osutil).__name__, self.osutil.service_name)
logger.info(os_info_msg)

# Launch monitoring threads
from azurelinuxagent.ga.monitor import get_monitor_handler
monitor_thread = get_monitor_handler()
monitor_thread.run()

# NOTE: Any telemetry events added from this point on will be properly populated with the container id.

from azurelinuxagent.ga.env import get_env_handler
env_thread = get_env_handler()
env_thread.run()
Expand All @@ -282,6 +286,12 @@ def run(self, debug=False):
self._ensure_readonly_files()
self._ensure_cgroups_initialized()

# Send OS-specific info as a telemetry event after the monitoring thread has been initialized, and with
# it the container id too.
add_event(AGENT_NAME,
op=WALAEventOperation.OSInfo,
message=os_info_msg)

goal_state_interval = GOAL_STATE_INTERVAL \
if conf.get_extensions_enabled() \
else GOAL_STATE_INTERVAL_DISABLED
Expand Down