Skip to content

Commit

Permalink
Update .NET tracing shim to correctly set span status (#5050)
Browse files Browse the repository at this point in the history
Co-authored-by: opentelemetrybot <[email protected]>
Co-authored-by: Fabrizio Ferri-Benedetti <[email protected]>
  • Loading branch information
3 people authored Aug 17, 2024
1 parent 8ffbcbc commit c8d70e9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions content/en/docs/languages/net/shim.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -385,7 +385,7 @@ try
}
catch (Exception ex)
{
span.SetStatus(Status.Error, "Something bad happened!");
span.SetStatus(new(StatusCode.Error, "Something bad happened!"));
}
```

Expand All @@ -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)
}
```
Expand Down

0 comments on commit c8d70e9

Please sign in to comment.