From c8d70e929c279d7e90d73e6ee7db11166db4c827 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Sat, 17 Aug 2024 06:05:19 -0700 Subject: [PATCH] Update .NET tracing shim to correctly set span status (#5050) Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com> Co-authored-by: Fabrizio Ferri-Benedetti --- content/en/docs/languages/net/shim.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/en/docs/languages/net/shim.md b/content/en/docs/languages/net/shim.md index 80f00fd7db44..94271c13ceb9 100644 --- a/content/en/docs/languages/net/shim.md +++ b/content/en/docs/languages/net/shim.md @@ -371,8 +371,8 @@ using var span = tracer.StartActiveSpan("another-span", links: links); A [status](/docs/concepts/signals/traces/#span-status) can be set on a span, typically used to specify that a span has not completed successfully - -`Status.Error`. In rare scenarios, you could override the `Error` status with -`Ok`, but don't set `Ok` on successfully-completed spans. +`StatusCode.Error`. In rare scenarios, you could override the `Error` status +with `Ok`, but don't set `Ok` on successfully-completed spans. The status can be set at any time before the span is finished: @@ -385,7 +385,7 @@ try } catch (Exception ex) { - span.SetStatus(Status.Error, "Something bad happened!"); + span.SetStatus(new(StatusCode.Error, "Something bad happened!")); } ``` @@ -403,7 +403,7 @@ try } catch (Exception ex) { - span.SetStatus(Status.Error, "Something bad happened!"); + span.SetStatus(new(StatusCode.Error, "Something bad happened!")); span.RecordException(ex) } ```