Skip to content

Commit 6121b30

Browse files
crossoverJieasweet-confluent
authored andcommitted
fix ci
1 parent 01a1bb0 commit 6121b30

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/rpc/RpcCommonAttributesExtractor.java

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,23 @@ public final void onEnd(
4949
REQUEST request,
5050
@Nullable RESPONSE response,
5151
@Nullable Throwable error) {
52-
internalSet(
53-
attributes, RPC_CLIENT_REQUEST_BODY_SIZE, (long) getter.getClientRequestSize(request));
54-
internalSet(
55-
attributes, RPC_CLIENT_RESPONSE_BODY_SIZE, (long) getter.getClientResponseSize(request));
56-
57-
internalSet(
58-
attributes, RPC_SERVER_REQUEST_BODY_SIZE, (long) getter.getServerRequestSize(request));
59-
internalSet(
60-
attributes, RPC_SERVER_RESPONSE_BODY_SIZE, (long) getter.getServerResponseSize(request));
52+
int clientRequestSize = getter.getClientRequestSize(request);
53+
if (clientRequestSize > 0) {
54+
internalSet(attributes, RPC_CLIENT_REQUEST_BODY_SIZE, (long) clientRequestSize);
55+
}
56+
int clientResponseSize = getter.getClientResponseSize(request);
57+
if (clientResponseSize > 0) {
58+
internalSet(attributes, RPC_CLIENT_RESPONSE_BODY_SIZE, (long) clientResponseSize);
59+
}
60+
61+
int serverRequestSize = getter.getServerRequestSize(request);
62+
if (serverRequestSize > 0) {
63+
internalSet(attributes, RPC_SERVER_REQUEST_BODY_SIZE, (long) serverRequestSize);
64+
}
65+
66+
int serverResponseSize = getter.getServerResponseSize(request);
67+
if (serverResponseSize > 0) {
68+
internalSet(attributes, RPC_SERVER_RESPONSE_BODY_SIZE, (long) serverResponseSize);
69+
}
6170
}
6271
}

0 commit comments

Comments
 (0)