diff --git a/azurelinuxagent/common/event.py b/azurelinuxagent/common/event.py
index 95abf09ed..514c727ff 100644
--- a/azurelinuxagent/common/event.py
+++ b/azurelinuxagent/common/event.py
@@ -366,10 +366,14 @@ def __init__(self):
# Parameters from OS
osutil = get_osutil()
+ keyword_name = {
+ "CpuArchitecture": osutil.get_vm_arch()
+ }
self._common_parameters.append(TelemetryEventParam(CommonTelemetryEventSchema.OSVersion, EventLogger._get_os_version()))
self._common_parameters.append(TelemetryEventParam(CommonTelemetryEventSchema.ExecutionMode, AGENT_EXECUTION_MODE))
self._common_parameters.append(TelemetryEventParam(CommonTelemetryEventSchema.RAM, int(EventLogger._get_ram(osutil))))
self._common_parameters.append(TelemetryEventParam(CommonTelemetryEventSchema.Processors, int(EventLogger._get_processors(osutil))))
+ self._common_parameters.append(TelemetryEventParam(CommonTelemetryEventSchema.KeywordName, json.dumps(keyword_name)))
# Parameters from goal state
self._common_parameters.append(TelemetryEventParam(CommonTelemetryEventSchema.TenantName, "TenantName_UNINITIALIZED"))
@@ -597,8 +601,7 @@ def add_common_event_parameters(self, event, event_timestamp):
TelemetryEventParam(CommonTelemetryEventSchema.OpcodeName, event_timestamp.strftime(logger.Logger.LogTimeFormatInUTC)),
TelemetryEventParam(CommonTelemetryEventSchema.EventTid, threading.current_thread().ident),
TelemetryEventParam(CommonTelemetryEventSchema.EventPid, os.getpid()),
- TelemetryEventParam(CommonTelemetryEventSchema.TaskName, threading.current_thread().getName()),
- TelemetryEventParam(CommonTelemetryEventSchema.KeywordName, '')]
+ TelemetryEventParam(CommonTelemetryEventSchema.TaskName, threading.current_thread().getName())]
if event.eventId == TELEMETRY_EVENT_EVENT_ID and event.providerId == TELEMETRY_EVENT_PROVIDER_ID:
# Currently only the GuestAgentExtensionEvents has these columns, the other tables dont have them so skipping
diff --git a/azurelinuxagent/common/osutil/default.py b/azurelinuxagent/common/osutil/default.py
index 6430f83ec..69e20bea7 100644
--- a/azurelinuxagent/common/osutil/default.py
+++ b/azurelinuxagent/common/osutil/default.py
@@ -149,6 +149,14 @@ def get_systemd_unit_file_install_path():
def get_agent_bin_path():
return "/usr/sbin"
+ @staticmethod
+ def get_vm_arch():
+ try:
+ return platform.machine()
+ except Exception as e:
+ logger.warn("Unable to determine cpu architecture: {0}", ustr(e))
+ return "unknown"
+
def get_firewall_dropped_packets(self, dst_ip=None):
# If a previous attempt failed, do not retry
global _enable_firewall # pylint: disable=W0603
diff --git a/azurelinuxagent/ga/update.py b/azurelinuxagent/ga/update.py
index cd37a32ee..147402709 100644
--- a/azurelinuxagent/ga/update.py
+++ b/azurelinuxagent/ga/update.py
@@ -315,10 +315,14 @@ def run(self, debug=False):
logger.info("OS: {0} {1}", DISTRO_NAME, DISTRO_VERSION)
logger.info("Python: {0}.{1}.{2}", PY_VERSION_MAJOR, PY_VERSION_MINOR, PY_VERSION_MICRO)
+ vm_arch = self.osutil.get_vm_arch()
+ logger.info("CPU Arch: {0}", vm_arch)
+
os_info_msg = u"Distro: {dist_name}-{dist_ver}; "\
u"OSUtil: {util_name}; "\
u"AgentService: {service_name}; "\
u"Python: {py_major}.{py_minor}.{py_micro}; "\
+ u"Arch: {vm_arch}; "\
u"systemd: {systemd}; "\
u"LISDrivers: {lis_ver}; "\
u"logrotate: {has_logrotate};".format(
@@ -326,7 +330,7 @@ def run(self, debug=False):
util_name=type(self.osutil).__name__,
service_name=self.osutil.service_name,
py_major=PY_VERSION_MAJOR, py_minor=PY_VERSION_MINOR,
- py_micro=PY_VERSION_MICRO, systemd=systemd.is_systemd(),
+ py_micro=PY_VERSION_MICRO, vm_arch=vm_arch, systemd=systemd.is_systemd(),
lis_ver=get_lis_version(), has_logrotate=has_logrotate()
)
logger.info(os_info_msg)
@@ -1013,13 +1017,10 @@ def _send_heartbeat_telemetry(self, protocol):
if datetime.utcnow() >= (self._last_telemetry_heartbeat + UpdateHandler.TELEMETRY_HEARTBEAT_PERIOD):
dropped_packets = self.osutil.get_firewall_dropped_packets(protocol.get_endpoint())
auto_update_enabled = 1 if conf.get_autoupdate_enabled() else 0
- # Include vm architecture in the heartbeat message because the kusto table does not have
- # a separate column for it.
- vmarch = self._get_vm_arch()
- telemetry_msg = "{0};{1};{2};{3};{4};{5}".format(self._heartbeat_counter, self._heartbeat_id, dropped_packets,
+ telemetry_msg = "{0};{1};{2};{3};{4}".format(self._heartbeat_counter, self._heartbeat_id, dropped_packets,
self._heartbeat_update_goal_state_error_count,
- auto_update_enabled, vmarch)
+ auto_update_enabled)
debug_log_msg = "[DEBUG HeartbeatCounter: {0};HeartbeatId: {1};DroppedPackets: {2};" \
"UpdateGSErrors: {3};AutoUpdate: {4}]".format(self._heartbeat_counter,
self._heartbeat_id, dropped_packets,
diff --git a/tests/common/test_event.py b/tests/common/test_event.py
index 28f2e3860..435ac2e80 100644
--- a/tests/common/test_event.py
+++ b/tests/common/test_event.py
@@ -20,6 +20,7 @@
import json
import os
+import platform
import re
import shutil
import threading
@@ -70,7 +71,7 @@ def setUp(self):
CommonTelemetryEventSchema.EventTid: threading.current_thread().ident,
CommonTelemetryEventSchema.EventPid: os.getpid(),
CommonTelemetryEventSchema.TaskName: threading.current_thread().getName(),
- CommonTelemetryEventSchema.KeywordName: '',
+ CommonTelemetryEventSchema.KeywordName: json.dumps({"CpuArchitecture": platform.machine()}),
# common parameters computed from the OS platform
CommonTelemetryEventSchema.OSVersion: EventLoggerTools.get_expected_os_version(),
CommonTelemetryEventSchema.ExecutionMode: AGENT_EXECUTION_MODE,
diff --git a/tests/ga/test_send_telemetry_events.py b/tests/ga/test_send_telemetry_events.py
index c9e04a38c..a9c87dde9 100644
--- a/tests/ga/test_send_telemetry_events.py
+++ b/tests/ga/test_send_telemetry_events.py
@@ -368,13 +368,13 @@ def test_it_should_enqueue_and_send_events_properly(self, mock_lib_dir, *_):
'' \
'' \
'' \
- '' \
'' \
'' \
'' \
'' \
'' \
'' \
+ '' \
'' \
'' \
'' \
@@ -385,7 +385,7 @@ def test_it_should_enqueue_and_send_events_properly(self, mock_lib_dir, *_):
'' \
']]>'.format(AGENT_VERSION, TestSendTelemetryEventsHandler._TEST_EVENT_OPERATION, CURRENT_AGENT, test_opcodename, test_eventtid,
test_eventpid, test_taskname, osversion, int(osutil.get_total_mem()),
- osutil.get_processor_cores()).encode('utf-8')
+ osutil.get_processor_cores(), json.dumps({"CpuArchitecture": platform.machine()})).encode('utf-8')
self.assertIn(sample_message, collected_event)