You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
logger.warn("Failed to get IMDS info; will be missing from telemetry: {0}", ustr(e))
465
468
469
+
# The KeywordName column is initialized with the CPUArch in EventLogger.__init__(). The security type is
470
+
# not yet discovered at that time because it requires a network call, so we update KeywordName here with the
471
+
# IsCVM value.
472
+
# The security type is initialized by the ConfidentialVMInfo class because it fetches metadata from IMDS with
473
+
# the minimum version that supports the security type field. We do not use that minimum version in the IMDS
474
+
# request in this method due to inadequate saturation of that version in the fleet. When the ConfidentialVMInfo
475
+
# class attributes are initialized, AgentGlobals is also updated with the security type, so we can get the
476
+
# security type in this module without introducing dependencies on the ConfidentialVMInfo class.
477
+
try:
478
+
keyword_name_str=parameters[CommonTelemetryEventSchema.KeywordName].value# Get the current value of keywordName
479
+
keyword_name_json=json.loads(keyword_name_str) # Convert the string to JSON
480
+
# AgentGlobals.get_is_cvm() raises if cvm info is not initialized so the IsCVM value in the keywordName
481
+
# column would remain uninitialized in that case
482
+
is_cvm=AgentGlobals.get_is_cvm() # Get the CVM state from AgentGlobals
483
+
keyword_name_json["IsCVM"] =is_cvm# Update the security type in the JSON
484
+
parameters[CommonTelemetryEventSchema.KeywordName].value=json.dumps(keyword_name_json) # Convert the JSON back to string and update the value of keywordName
485
+
exceptExceptionase:
486
+
logger.warn("Failed to update the KeywordName column with IsCVM; will be missing from telemetry: {0}", ustr(e))
487
+
466
488
defsave_event(self, data):
467
489
ifself.event_dirisNone:
468
490
logger.warn("Cannot save event -- Event reporter is not initialized.")
0 commit comments