Skip to content

Commit dee16a4

Browse files
committed
fix(observability): populate rpc.method for HTTP json transport
1 parent d481d33 commit dee16a4

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

bazel-google-cloud-java-2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/private/var/tmp/_bazel_blakeli/32c27350f2eca8f4de729224e67247b0/execroot/_main
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"java.compile.nullAnalysis.mode": "automatic"
3+
}

sdk-platform-java/gax-java/gax/src/main/java/com/google/api/gax/tracing/ApiTracerContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public Map<String, Object> getAttemptAttributes() {
194194
attributes.put(ObservabilityAttributes.VERSION_ATTRIBUTE, libraryMetadata().version());
195195
}
196196
}
197-
if (transport() == Transport.GRPC && !Strings.isNullOrEmpty(fullMethodName())) {
197+
if (!Strings.isNullOrEmpty(fullMethodName())) {
198198
attributes.put(ObservabilityAttributes.GRPC_RPC_METHOD_ATTRIBUTE, fullMethodName());
199199
}
200200
if (transport() == Transport.HTTP) {
@@ -232,7 +232,7 @@ Map<String, Object> getMetricsAttributes() {
232232
if (!Strings.isNullOrEmpty(rpcSystemName())) {
233233
attributes.put(ObservabilityAttributes.RPC_SYSTEM_NAME_ATTRIBUTE, rpcSystemName());
234234
}
235-
if (transport() == Transport.GRPC && !Strings.isNullOrEmpty(fullMethodName())) {
235+
if (!Strings.isNullOrEmpty(fullMethodName())) {
236236
attributes.put(ObservabilityAttributes.GRPC_RPC_METHOD_ATTRIBUTE, fullMethodName());
237237
}
238238
if (!Strings.isNullOrEmpty(urlDomain())) {

sdk-platform-java/java-showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITOtelGoldenMetrics.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ void testMetrics_successfulEcho_httpjson() throws Exception {
254254
.isEqualTo("v1beta1/echo:echo");
255255
assertThat(
256256
attributes.get(AttributeKey.stringKey(ObservabilityAttributes.GRPC_RPC_METHOD_ATTRIBUTE)))
257-
.isNull();
257+
.isEqualTo("google.showcase.v1beta1.Echo/Echo");
258258
}
259259
}
260260

0 commit comments

Comments
 (0)