Skip to content

Commit 063160f

Browse files
crossoverJieasweet-confluent
authored andcommitted
remove client&server prefix.
1 parent 1438a0a commit 063160f

File tree

9 files changed

+70
-96
lines changed

9 files changed

+70
-96
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ public void onEnd(Context context, Attributes endAttributes, long endNanos) {
9999
(endNanos - state.startTimeNanos()) / NANOS_PER_MS, attributes, context);
100100

101101
Long rpcClientRequestBodySize =
102-
RpcMessageBodySizeUtil.getRpcClientRequestBodySize(endAttributes, state.startAttributes());
102+
RpcMessageBodySizeUtil.getRpcRequestBodySize(endAttributes, state.startAttributes());
103103
if (rpcClientRequestBodySize != null) {
104104
clientRequestSize.record(rpcClientRequestBodySize, attributes, context);
105105
}
106106

107107
Long rpcClientResponseBodySize =
108-
RpcMessageBodySizeUtil.getRpcClientResponseBodySize(endAttributes, state.startAttributes());
108+
RpcMessageBodySizeUtil.getRpcResponseBodySize(endAttributes, state.startAttributes());
109109
if (rpcClientResponseBodySize != null) {
110110
clientResponseSize.record(rpcClientResponseBodySize, attributes, context);
111111
}

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@ abstract class RpcCommonAttributesExtractor<REQUEST, RESPONSE>
2020
static final AttributeKey<String> RPC_METHOD = AttributeKey.stringKey("rpc.method");
2121
static final AttributeKey<String> RPC_SERVICE = AttributeKey.stringKey("rpc.service");
2222
static final AttributeKey<String> RPC_SYSTEM = AttributeKey.stringKey("rpc.system");
23-
static final AttributeKey<Long> RPC_CLIENT_REQUEST_BODY_SIZE =
24-
AttributeKey.longKey("rpc.client.request.body.size");
25-
static final AttributeKey<Long> RPC_CLIENT_RESPONSE_BODY_SIZE =
26-
AttributeKey.longKey("rpc.client.response.body.size");
27-
static final AttributeKey<Long> RPC_SERVER_REQUEST_BODY_SIZE =
28-
AttributeKey.longKey("rpc.server.request.body.size");
29-
static final AttributeKey<Long> RPC_SERVER_RESPONSE_BODY_SIZE =
30-
AttributeKey.longKey("rpc.server.response.body.size");
23+
static final AttributeKey<Long> RPC_REQUEST_BODY_SIZE =
24+
AttributeKey.longKey("rpc.request.body.size");
25+
static final AttributeKey<Long> RPC_RESPONSE_BODY_SIZE =
26+
AttributeKey.longKey("rpc.response.body.size");
3127

3228
private final RpcAttributesGetter<REQUEST> getter;
3329

@@ -53,19 +49,19 @@ public final void onEnd(
5349
Long responseSize = getter.getResponseSize(request);
5450
if (this instanceof RpcClientAttributesExtractor) {
5551
if (requestSize != null) {
56-
internalSet(attributes, RPC_CLIENT_REQUEST_BODY_SIZE, requestSize);
52+
internalSet(attributes, RPC_REQUEST_BODY_SIZE, requestSize);
5753
}
5854
if (responseSize != null) {
59-
internalSet(attributes, RPC_CLIENT_RESPONSE_BODY_SIZE, responseSize);
55+
internalSet(attributes, RPC_RESPONSE_BODY_SIZE, responseSize);
6056
}
6157
}
6258

6359
if (this instanceof RpcServerAttributesExtractor) {
6460
if (requestSize != null) {
65-
internalSet(attributes, RPC_SERVER_REQUEST_BODY_SIZE, requestSize);
61+
internalSet(attributes, RPC_REQUEST_BODY_SIZE, requestSize);
6662
}
6763
if (responseSize != null) {
68-
internalSet(attributes, RPC_SERVER_RESPONSE_BODY_SIZE, responseSize);
64+
internalSet(attributes, RPC_RESPONSE_BODY_SIZE, responseSize);
6965
}
7066
}
7167
}

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

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,13 @@
1212
final class RpcMessageBodySizeUtil {
1313

1414
@Nullable
15-
static Long getRpcClientRequestBodySize(Attributes... attributesList) {
16-
return getAttribute(RpcCommonAttributesExtractor.RPC_CLIENT_REQUEST_BODY_SIZE, attributesList);
15+
static Long getRpcRequestBodySize(Attributes... attributesList) {
16+
return getAttribute(RpcCommonAttributesExtractor.RPC_REQUEST_BODY_SIZE, attributesList);
1717
}
1818

1919
@Nullable
20-
static Long getRpcClientResponseBodySize(Attributes... attributesList) {
21-
return getAttribute(RpcCommonAttributesExtractor.RPC_CLIENT_RESPONSE_BODY_SIZE, attributesList);
22-
}
23-
24-
@Nullable
25-
static Long getRpcServerRequestBodySize(Attributes... attributesList) {
26-
return getAttribute(RpcCommonAttributesExtractor.RPC_SERVER_REQUEST_BODY_SIZE, attributesList);
27-
}
28-
29-
@Nullable
30-
static Long getRpcServerResponseBodySize(Attributes... attributesList) {
31-
return getAttribute(RpcCommonAttributesExtractor.RPC_SERVER_RESPONSE_BODY_SIZE, attributesList);
20+
static Long getRpcResponseBodySize(Attributes... attributesList) {
21+
return getAttribute(RpcCommonAttributesExtractor.RPC_RESPONSE_BODY_SIZE, attributesList);
3222
}
3323

3424
@Nullable

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ public void onEnd(Context context, Attributes endAttributes, long endNanos) {
9999
(endNanos - state.startTimeNanos()) / NANOS_PER_MS, attributes, context);
100100

101101
Long rpcServerRequestBodySize =
102-
RpcMessageBodySizeUtil.getRpcServerRequestBodySize(endAttributes, state.startAttributes());
102+
RpcMessageBodySizeUtil.getRpcRequestBodySize(endAttributes, state.startAttributes());
103103
if (rpcServerRequestBodySize != null) {
104104
serverRequestSize.record(rpcServerRequestBodySize, attributes, context);
105105
}
106106

107107
Long rpcServerResponseBodySize =
108-
RpcMessageBodySizeUtil.getRpcServerResponseBodySize(endAttributes, state.startAttributes());
108+
RpcMessageBodySizeUtil.getRpcResponseBodySize(endAttributes, state.startAttributes());
109109
if (rpcServerResponseBodySize != null) {
110110
serverResponseSize.record(rpcServerResponseBodySize, attributes, context);
111111
}

instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/rpc/RpcClientMetricsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ void collectsMetrics() {
4646
.put(ServerAttributes.SERVER_PORT, 8080)
4747
.put(NetworkAttributes.NETWORK_TRANSPORT, "tcp")
4848
.put(NetworkAttributes.NETWORK_TYPE, "ipv4")
49-
.put(RpcCommonAttributesExtractor.RPC_CLIENT_REQUEST_BODY_SIZE, 10)
50-
.put(RpcCommonAttributesExtractor.RPC_CLIENT_RESPONSE_BODY_SIZE, 20)
49+
.put(RpcCommonAttributesExtractor.RPC_REQUEST_BODY_SIZE, 10)
50+
.put(RpcCommonAttributesExtractor.RPC_RESPONSE_BODY_SIZE, 20)
5151
.build();
5252

5353
Attributes responseAttributes2 =

instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/rpc/RpcServerMetricsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ void collectsMetrics() {
4747
.put(NetworkAttributes.NETWORK_LOCAL_ADDRESS, "127.0.0.1")
4848
.put(NetworkAttributes.NETWORK_TRANSPORT, "tcp")
4949
.put(NetworkAttributes.NETWORK_TYPE, "ipv4")
50-
.put(RpcCommonAttributesExtractor.RPC_SERVER_REQUEST_BODY_SIZE, 10)
51-
.put(RpcCommonAttributesExtractor.RPC_SERVER_RESPONSE_BODY_SIZE, 20)
50+
.put(RpcCommonAttributesExtractor.RPC_REQUEST_BODY_SIZE, 10)
51+
.put(RpcCommonAttributesExtractor.RPC_RESPONSE_BODY_SIZE, 20)
5252
.build();
5353

5454
Attributes responseAttributes2 =

instrumentation/armeria/armeria-grpc-1.14/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/armeria/grpc/v1_14/ArmeriaGrpcTest.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,10 @@ class ArmeriaGrpcTest {
3434
@RegisterExtension
3535
static final AgentInstrumentationExtension testing = AgentInstrumentationExtension.create();
3636

37-
private static final AttributeKey<Long> RPC_CLIENT_REQUEST_BODY_SIZE =
38-
AttributeKey.longKey("rpc.client.request.body.size");
39-
private static final AttributeKey<Long> RPC_CLIENT_RESPONSE_BODY_SIZE =
40-
AttributeKey.longKey("rpc.client.response.body.size");
41-
private static final AttributeKey<Long> RPC_SERVER_REQUEST_BODY_SIZE =
42-
AttributeKey.longKey("rpc.server.request.body.size");
43-
private static final AttributeKey<Long> RPC_SERVER_RESPONSE_BODY_SIZE =
44-
AttributeKey.longKey("rpc.server.response.body.size");
37+
private static final AttributeKey<Long> RPC_REQUEST_BODY_SIZE =
38+
AttributeKey.longKey("rpc.request.body.size");
39+
private static final AttributeKey<Long> RPC_RESPONSE_BODY_SIZE =
40+
AttributeKey.longKey("rpc.response.body.size");
4541

4642
@RegisterExtension
4743
static final ServerExtension server =
@@ -95,8 +91,8 @@ void grpcInstrumentation() {
9591
equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()),
9692
equalTo(SERVER_ADDRESS, "127.0.0.1"),
9793
equalTo(SERVER_PORT, (long) server.httpPort()))
98-
equalTo(RPC_CLIENT_RESPONSE_BODY_SIZE, responseSerializedSize),
99-
equalTo(RPC_CLIENT_REQUEST_BODY_SIZE, requestSerializedSize))
94+
equalTo(RPC_RESPONSE_BODY_SIZE, responseSerializedSize),
95+
equalTo(RPC_REQUEST_BODY_SIZE, requestSerializedSize))
10096
.hasEventsSatisfyingExactly(
10197
event ->
10298
event
@@ -122,8 +118,8 @@ void grpcInstrumentation() {
122118
equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()),
123119
equalTo(SERVER_ADDRESS, "127.0.0.1"),
124120
equalTo(SERVER_PORT, server.httpPort()))
125-
equalTo(RPC_SERVER_REQUEST_BODY_SIZE, responseSerializedSize),
126-
equalTo(RPC_SERVER_RESPONSE_BODY_SIZE, requestSerializedSize))
121+
equalTo(RPC_REQUEST_BODY_SIZE, responseSerializedSize),
122+
equalTo(RPC_RESPONSE_BODY_SIZE, requestSerializedSize))
127123
.hasEventsSatisfyingExactly(
128124
event ->
129125
event

instrumentation/grpc-1.6/testing/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/AbstractGrpcStreamingTest.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,10 @@
5353

5454
public abstract class AbstractGrpcStreamingTest {
5555

56-
private static final AttributeKey<Long> RPC_CLIENT_REQUEST_BODY_SIZE =
57-
AttributeKey.longKey("rpc.client.request.body.size");
58-
private static final AttributeKey<Long> RPC_CLIENT_RESPONSE_BODY_SIZE =
59-
AttributeKey.longKey("rpc.client.response.body.size");
60-
private static final AttributeKey<Long> RPC_SERVER_REQUEST_BODY_SIZE =
61-
AttributeKey.longKey("rpc.server.request.body.size");
62-
private static final AttributeKey<Long> RPC_SERVER_RESPONSE_BODY_SIZE =
63-
AttributeKey.longKey("rpc.server.response.body.size");
56+
private static final AttributeKey<Long> RPC_REQUEST_BODY_SIZE =
57+
AttributeKey.longKey("rpc.request.body.size");
58+
private static final AttributeKey<Long> RPC_RESPONSE_BODY_SIZE =
59+
AttributeKey.longKey("rpc.response.body.size");
6460

6561
protected abstract ServerBuilder<?> configureServer(ServerBuilder<?> server);
6662

@@ -242,8 +238,8 @@ public void onCompleted() {
242238
equalTo(RPC_GRPC_STATUS_CODE, (long) Status.Code.OK.value()),
243239
equalTo(SERVER_ADDRESS, "localhost"),
244240
equalTo(SERVER_PORT, (long) server.getPort())))
245-
equalTo(RPC_CLIENT_RESPONSE_BODY_SIZE, requestSerializedSize),
246-
equalTo(RPC_CLIENT_REQUEST_BODY_SIZE, requestSerializedSize),
241+
equalTo(RPC_RESPONSE_BODY_SIZE, requestSerializedSize),
242+
equalTo(RPC_REQUEST_BODY_SIZE, requestSerializedSize),
247243
.satisfies(
248244
spanData ->
249245
assertThat(spanData.getEvents())
@@ -261,8 +257,8 @@ public void onCompleted() {
261257
equalTo(SERVER_PORT, server.getPort()),
262258
equalTo(NETWORK_TYPE, "ipv4"),
263259
equalTo(NETWORK_PEER_ADDRESS, "127.0.0.1"),
264-
equalTo(RPC_SERVER_REQUEST_BODY_SIZE, requestSerializedSize),
265-
equalTo(RPC_SERVER_RESPONSE_BODY_SIZE, requestSerializedSize),
260+
equalTo(RPC_REQUEST_BODY_SIZE, requestSerializedSize),
261+
equalTo(RPC_RESPONSE_BODY_SIZE, requestSerializedSize),
266262
satisfies(NETWORK_PEER_PORT, val -> assertThat(val).isNotNull()))
267263
.satisfies(
268264
spanData ->

0 commit comments

Comments
 (0)