Skip to content
Open
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
24 changes: 16 additions & 8 deletions src/Agent.Listener/Agent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,22 @@ public async Task<int> ExecuteCommand(CommandSettings command)
var systemVersion = PlatformUtil.GetSystemVersion();

Dictionary<string, string> telemetryData = new Dictionary<string, string>
{
{ "OS", PlatformUtil.GetSystemId() ?? "" },
{ "OSVersion", systemVersion?.Name?.ToString() ?? "" },
{ "OSBuild", systemVersion?.Version?.ToString() ?? "" },
{ "configuredAsService", $"{configuredAsService}"},
{ "startupType", startupTypeAsString }
};
{
{ "OS", PlatformUtil.GetSystemId() ?? "" },
{ "OSVersion", systemVersion?.Name?.ToString() ?? "" },
{ "OSBuild", systemVersion?.Version?.ToString() ?? "" },
{ "configuredAsService", $"{configuredAsService}"},
{ "startupType", startupTypeAsString }
};

// Check for EnableAgent fallback indicator
string fallbackUsed = Environment.GetEnvironmentVariable("VSTS_AGENT_VMEXT_FALLBACK_USED");
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not related to line) pending local testing, will resolve when complete

if (!string.IsNullOrEmpty(fallbackUsed) && fallbackUsed.Equals("true", StringComparison.OrdinalIgnoreCase))
{
telemetryData["EnableAgentVmExtFallbackUsed"] = "true";
Trace.Info("EnableAgent VM extension fallback detected");
}

var cmd = new Command("telemetry", "publish");
cmd.Data = JsonConvert.SerializeObject(telemetryData);
cmd.Properties.Add("area", "PipelinesTasks");
Expand All @@ -296,7 +305,6 @@ public async Task<int> ExecuteCommand(CommandSettings command)
Trace.Warning($"Unable to publish telemetry data. {ex}");
}


// Run the agent interactively or as service
return await RunAsync(settings, command.GetRunOnce());
}
Expand Down