Skip to content

Commit 815ecd4

Browse files
Update documentation for span.setStatus method (#14116)
The documentation in `platform-includes/distributed-tracing/custom-instrumentation/javascript.mdx` was updated to correct the usage of `span.setStatus`. * Previously, `span.setStatus({ code: 'error' });` was used. * This has been changed to `span.setStatus({ code: 2, message: 'error' });`. This modification aligns the documentation with the Sentry JavaScript SDK's `SpanStatus` interface, which expects a numerical `code` (following OpenTelemetry standards) rather than a string. The numerical code `2` signifies an 'error' status. This ensures that `span.setStatus` correctly updates the span's status, resolving issues where the status was not visually reflected due to incorrect API parameter types. Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent 029b520 commit 815ecd4

File tree

1 file changed

+1
-1
lines changed
  • platform-includes/distributed-tracing/custom-instrumentation

1 file changed

+1
-1
lines changed

platform-includes/distributed-tracing/custom-instrumentation/javascript.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function sentryInterceptor(methodDescriptor, nextCall) {
108108
if (span) {
109109
// Update status based on the gRPC result
110110
if (status.code !== grpc.status.OK) {
111-
span.setStatus({ code: 'error' });
111+
span.setStatus({ code: 2, message: 'error' });
112112
span.setAttribute('grpc.status_code', status.code);
113113
span.setAttribute('grpc.status_description', status.details);
114114
}

0 commit comments

Comments
 (0)