|
25 | 25 |
|
26 | 26 | final class TracingServerInterceptor implements ServerInterceptor {
|
27 | 27 |
|
| 28 | + private static final AttributeKey<Boolean> GRPC_CANCELED = |
| 29 | + AttributeKey.booleanKey("grpc.canceled"); |
| 30 | + private static final AttributeKey<Long> GRPC_MESSAGES_RECEIVED = |
| 31 | + AttributeKey.longKey("grpc.messages.received"); |
| 32 | + private static final AttributeKey<Long> GRPC_MESSAGES_SENT = |
| 33 | + AttributeKey.longKey("grpc.messages.sent"); |
28 | 34 | // copied from MessageIncubatingAttributes
|
29 | 35 | private static final AttributeKey<Long> MESSAGE_ID = AttributeKey.longKey("message.id");
|
30 | 36 | private static final AttributeKey<String> MESSAGE_TYPE = AttributeKey.stringKey("message.type");
|
@@ -151,11 +157,11 @@ private void end(Context context, GrpcRequest request, Status response, Throwabl
|
151 | 157 | if (captureExperimentalSpanAttributes) {
|
152 | 158 | Span span = Span.fromContext(context);
|
153 | 159 | span.setAttribute(
|
154 |
| - "grpc.messages.received", RECEIVED_MESSAGE_ID_UPDATER.get(TracingServerCall.this)); |
| 160 | + GRPC_MESSAGES_RECEIVED, RECEIVED_MESSAGE_ID_UPDATER.get(TracingServerCall.this)); |
155 | 161 | span.setAttribute(
|
156 |
| - "grpc.messages.sent", SENT_MESSAGE_ID_UPDATER.get(TracingServerCall.this)); |
| 162 | + GRPC_MESSAGES_SENT, SENT_MESSAGE_ID_UPDATER.get(TracingServerCall.this)); |
157 | 163 | if (Status.CANCELLED.equals(status)) {
|
158 |
| - span.setAttribute("grpc.canceled", true); |
| 164 | + span.setAttribute(GRPC_CANCELED, true); |
159 | 165 | }
|
160 | 166 | }
|
161 | 167 | instrumenter.end(context, request, response, error);
|
|
0 commit comments