From 2389f03d2d44a9e164f37a65c7777d66e3fd010c Mon Sep 17 00:00:00 2001 From: Carlos D Date: Tue, 19 Nov 2024 15:33:10 +1100 Subject: [PATCH] Unformatted trace logging for step telemetry in ExecutionContext Don't apply JSON formatting during the trace logging for step telemetry. By default `StringUtil.ConvertToJson` uses `Formatting.Indented` which causes multi-line logs for this particular json object. The data contained in this particular log line is useful for operators of self-hosted runners who are looking to use log aggregates to understand their overall usage and performance. Parsing multi-line data in log aggregates is very hard to get right, if not outright impossible depending on how logs are aggregated. --- src/Runner.Worker/ExecutionContext.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Runner.Worker/ExecutionContext.cs b/src/Runner.Worker/ExecutionContext.cs index dfe92523089..5ea5328be84 100644 --- a/src/Runner.Worker/ExecutionContext.cs +++ b/src/Runner.Worker/ExecutionContext.cs @@ -1145,7 +1145,7 @@ public void PublishStepTelemetry() } } - Trace.Info($"Publish step telemetry for current step {StringUtil.ConvertToJson(StepTelemetry)}."); + Trace.Info($"Publish step telemetry for current step {StringUtil.ConvertToJson(StepTelemetry, Formatting.None)}."); Global.StepsTelemetry.Add(StepTelemetry); _stepTelemetryPublished = true; }