Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make rpc.grpc.status_code required #6184

Merged
merged 1 commit into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public <REQUEST, RESPONSE> ClientCall<REQUEST, RESPONSE> interceptCall(
// call other interceptors
result = next.newCall(method, callOptions);
} catch (Throwable e) {
instrumenter.end(context, request, null, e);
instrumenter.end(context, request, Status.UNKNOWN, e);
throw e;
}
}
Expand Down Expand Up @@ -100,7 +100,7 @@ public void start(Listener<RESPONSE> responseListener, Metadata headers) {
new TracingClientCallListener(responseListener, parentContext, context, request),
headers);
} catch (Throwable e) {
instrumenter.end(context, request, null, e);
instrumenter.end(context, request, Status.UNKNOWN, e);
throw e;
}
}
Expand All @@ -110,7 +110,7 @@ public void sendMessage(REQUEST message) {
try (Scope ignored = context.makeCurrent()) {
super.sendMessage(message);
} catch (Throwable e) {
instrumenter.end(context, request, null, e);
instrumenter.end(context, request, Status.UNKNOWN, e);
throw e;
}
Span span = Span.fromContext(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public <REQUEST, RESPONSE> ServerCall.Listener<REQUEST> interceptCall(
try (Scope ignored = context.makeCurrent()) {
return new TracingServerCall<>(call, context, request).start(headers, next);
} catch (Throwable e) {
instrumenter.end(context, request, null, e);
instrumenter.end(context, request, Status.UNKNOWN, e);
throw e;
}
}
Expand Down Expand Up @@ -132,7 +132,7 @@ public void onHalfClose() {
try {
delegate().onHalfClose();
} catch (Throwable e) {
instrumenter.end(context, request, null, e);
instrumenter.end(context, request, Status.UNKNOWN, e);
throw e;
}
}
Expand All @@ -145,18 +145,18 @@ public void onCancel() {
Span.fromContext(context).setAttribute("grpc.canceled", true);
}
} catch (Throwable e) {
instrumenter.end(context, request, null, e);
instrumenter.end(context, request, Status.UNKNOWN, e);
throw e;
}
instrumenter.end(context, request, null, null);
instrumenter.end(context, request, Status.CANCELLED, null);
}

@Override
public void onComplete() {
try {
delegate().onComplete();
} catch (Throwable e) {
instrumenter.end(context, request, null, e);
instrumenter.end(context, request, Status.UNKNOWN, e);
throw e;
}
}
Expand All @@ -166,7 +166,7 @@ public void onReady() {
try {
delegate().onReady();
} catch (Throwable e) {
instrumenter.end(context, request, null, e);
instrumenter.end(context, request, Status.UNKNOWN, e);
throw e;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,10 @@ public void sayHello(
val -> assertThat(val).isNotNull()),
equalTo(
SemanticAttributes.NET_TRANSPORT,
SemanticAttributes.NetTransportValues.IP_TCP))
SemanticAttributes.NetTransportValues.IP_TCP),
equalTo(
SemanticAttributes.RPC_GRPC_STATUS_CODE,
(long) Status.Code.UNKNOWN.value()))
.hasEventsSatisfying(
events -> {
assertThat(events).hasSize(2);
Expand Down Expand Up @@ -1289,7 +1292,10 @@ public void onCompleted() {
val -> assertThat(val).isNotNull()),
equalTo(
SemanticAttributes.NET_TRANSPORT,
SemanticAttributes.NetTransportValues.IP_TCP))
SemanticAttributes.NetTransportValues.IP_TCP),
equalTo(
SemanticAttributes.RPC_GRPC_STATUS_CODE,
(long) Status.Code.CANCELLED.value()))
.hasEventsSatisfyingExactly(
event ->
event
Expand Down