From 3e34fb10c190e9215e07bee560bfc4972af2bc23 Mon Sep 17 00:00:00 2001 From: eric sciple Date: Mon, 15 Nov 2021 13:42:57 -0600 Subject: [PATCH] improve telemetry to better diagnose runner configuration issues (#1487) --- src/Runner.Common/HostContext.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Runner.Common/HostContext.cs b/src/Runner.Common/HostContext.cs index 34b303cd9..9205faf58 100644 --- a/src/Runner.Common/HostContext.cs +++ b/src/Runner.Common/HostContext.cs @@ -200,9 +200,17 @@ namespace GitHub.Runner.Common if (credData != null && credData.Data.TryGetValue("clientId", out var clientId)) { - _userAgents.Add(new ProductInfoHeaderValue($"RunnerId", clientId)); + _userAgents.Add(new ProductInfoHeaderValue("ClientId", clientId)); } } + + var runnerFile = GetConfigFile(WellKnownConfigFile.Runner); + if (File.Exists(runnerFile)) + { + var runnerSettings = IOUtil.LoadObject(runnerFile); + _userAgents.Add(new ProductInfoHeaderValue("RunnerId", runnerSettings.AgentId.ToString(CultureInfo.InvariantCulture))); + _userAgents.Add(new ProductInfoHeaderValue("GroupId", runnerSettings.PoolId.ToString(CultureInfo.InvariantCulture))); + } } public string GetDirectory(WellKnownDirectory directory)