diff --git a/src/Altinn.App.Core/Features/Telemetry/TelemetryActivityExtensions.cs b/src/Altinn.App.Core/Features/Telemetry/TelemetryActivityExtensions.cs index 190f00135..b2c8dab43 100644 --- a/src/Altinn.App.Core/Features/Telemetry/TelemetryActivityExtensions.cs +++ b/src/Altinn.App.Core/Features/Telemetry/TelemetryActivityExtensions.cs @@ -2,7 +2,6 @@ using Altinn.App.Core.Models.Process; using Altinn.Platform.Storage.Interface.Models; using Microsoft.AspNetCore.Mvc; -using OpenTelemetry.Trace; using InternalLabels = Altinn.App.Core.Features.Telemetry.InternalLabels; using Labels = Altinn.App.Core.Features.Telemetry.Labels; @@ -345,6 +344,9 @@ internal static Activity SetProblemDetails(this Activity activity, ProblemDetail internal static void Errored(this Activity activity, Exception? exception = null, string? error = null) { activity.SetStatus(ActivityStatusCode.Error, error); - activity.RecordException(exception); + if(exception is not null) + { + activity.AddException(exception); + } } }