Skip to content

Commit c8d70e9

Browse files
cartermpopentelemetrybottheletterf
authored
Update .NET tracing shim to correctly set span status (#5050)
Co-authored-by: opentelemetrybot <[email protected]> Co-authored-by: Fabrizio Ferri-Benedetti <[email protected]>
1 parent 8ffbcbc commit c8d70e9

File tree

1 file changed

+4
-4
lines changed
  • content/en/docs/languages/net

1 file changed

+4
-4
lines changed

content/en/docs/languages/net/shim.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,8 @@ using var span = tracer.StartActiveSpan("another-span", links: links);
371371

372372
A [status](/docs/concepts/signals/traces/#span-status) can be set on a span,
373373
typically used to specify that a span has not completed successfully -
374-
`Status.Error`. In rare scenarios, you could override the `Error` status with
375-
`Ok`, but don't set `Ok` on successfully-completed spans.
374+
`StatusCode.Error`. In rare scenarios, you could override the `Error` status
375+
with `Ok`, but don't set `Ok` on successfully-completed spans.
376376

377377
The status can be set at any time before the span is finished:
378378

@@ -385,7 +385,7 @@ try
385385
}
386386
catch (Exception ex)
387387
{
388-
span.SetStatus(Status.Error, "Something bad happened!");
388+
span.SetStatus(new(StatusCode.Error, "Something bad happened!"));
389389
}
390390
```
391391

@@ -403,7 +403,7 @@ try
403403
}
404404
catch (Exception ex)
405405
{
406-
span.SetStatus(Status.Error, "Something bad happened!");
406+
span.SetStatus(new(StatusCode.Error, "Something bad happened!"));
407407
span.RecordException(ex)
408408
}
409409
```

0 commit comments

Comments
 (0)