From b23560550b993107e72eeb032dc5c4ba1f21d931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Thu, 4 Apr 2024 11:25:20 +0200 Subject: [PATCH] Replace otel.status_code and otel.status_description by Activity.Status There is a recommendation to avoid setting Status.Ok. It should stay as Unset --- .../DiagnosticsActivityEventSubscriber.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/MongoDB.Driver.Core.Extensions.DiagnosticSources/DiagnosticsActivityEventSubscriber.cs b/src/MongoDB.Driver.Core.Extensions.DiagnosticSources/DiagnosticsActivityEventSubscriber.cs index 01abc9d..ec5401e 100644 --- a/src/MongoDB.Driver.Core.Extensions.DiagnosticSources/DiagnosticsActivityEventSubscriber.cs +++ b/src/MongoDB.Driver.Core.Extensions.DiagnosticSources/DiagnosticsActivityEventSubscriber.cs @@ -86,8 +86,6 @@ private void Handle(CommandSucceededEvent @event) { WithReplacedActivityCurrent(activity, () => { - activity.AddTag("otel.status_code", "OK"); - activity.SetStatus(ActivityStatusCode.Ok); activity.Stop(); }); } @@ -101,8 +99,7 @@ private void Handle(CommandFailedEvent @event) { if (activity.IsAllDataRequested) { - activity.AddTag("otel.status_code", "ERROR"); - activity.AddTag("otel.status_description", @event.Failure.Message); + activity.SetStatus(ActivityStatusCode.Error, @event.Failure.Message); activity.AddTag("exception.type", @event.Failure.GetType().FullName); activity.AddTag("exception.message", @event.Failure.Message); activity.AddTag("exception.stacktrace", @event.Failure.StackTrace);