From acb23f1104e47eae6bc6e3b23dbb027abb529730 Mon Sep 17 00:00:00 2001 From: Igor Bernstein Date: Fri, 9 Apr 2021 13:26:08 -0400 Subject: [PATCH 1/7] chore: improve embedded version handling Use new feature in releasetool (https://github.com/googleapis/releasetool/pull/317) to manage the client version instead of maven tricks introduced in https://github.com/googleapis/java-bigtable/pull/451 --- .../google/cloud/bigtable/ClientVersion.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/ClientVersion.java diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/ClientVersion.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/ClientVersion.java new file mode 100644 index 0000000000..d7c3d80af3 --- /dev/null +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/ClientVersion.java @@ -0,0 +1,25 @@ +/* + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.bigtable; + +import com.google.api.core.InternalApi; + +@InternalApi("For internal use only") +public final class ClientVersion { + // {x-version-update-start:google-cloud-bigtable:current} + public static String VERSION = "1.22.1-SNAPSHOT"; + // {x-version-update-end} +} From 9780be091d2516600d50e919448751d4e79ccb99 Mon Sep 17 00:00:00 2001 From: Igor Bernstein Date: Fri, 9 Apr 2021 13:29:35 -0400 Subject: [PATCH 2/7] migrate to new version scheme --- google-cloud-bigtable/pom.xml | 10 -------- .../data/v2/stub/EnhancedBigtableStub.java | 5 ++-- .../v2/stub/EnhancedBigtableStubSettings.java | 3 ++- .../com/google/cloud/bigtable/Version.java | 24 ------------------- 4 files changed, 4 insertions(+), 38 deletions(-) delete mode 100644 google-cloud-bigtable/src/main/templates/com/google/cloud/bigtable/Version.java diff --git a/google-cloud-bigtable/pom.xml b/google-cloud-bigtable/pom.xml index 8c9b525b9d..34007cdd7a 100644 --- a/google-cloud-bigtable/pom.xml +++ b/google-cloud-bigtable/pom.xml @@ -427,16 +427,6 @@ - - - src/main/templates - - **/*.java - - true - ${project.build.directory}/generated-sources/java - - org.codehaus.mojo diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java index 8f2505c58f..121c6c0e72 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java @@ -54,6 +54,7 @@ import com.google.bigtable.v2.ReadRowsResponse; import com.google.bigtable.v2.SampleRowKeysRequest; import com.google.bigtable.v2.SampleRowKeysResponse; +import com.google.cloud.bigtable.ClientVersion; import com.google.cloud.bigtable.data.v2.internal.RequestContext; import com.google.cloud.bigtable.data.v2.models.BulkMutation; import com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation; @@ -194,9 +195,7 @@ public static EnhancedBigtableStubSettings finalizeSettings( // Also annotate traces with library versions .put("gax", GaxGrpcProperties.getGaxGrpcVersion()) .put("grpc", GaxGrpcProperties.getGrpcVersion()) - .put( - "gapic", - GaxProperties.getLibraryVersion(EnhancedBigtableStubSettings.class)) + .put("gapic", ClientVersion.VERSION) .build()), // Add OpenCensus Metrics MetricsTracerFactory.create(tagger, stats, attributes), diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java index eaea47f4ef..baa7ff6a90 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java @@ -31,6 +31,7 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.auth.Credentials; +import com.google.cloud.bigtable.ClientVersion; import com.google.cloud.bigtable.Version; import com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation; import com.google.cloud.bigtable.data.v2.models.KeyOffset; @@ -537,7 +538,7 @@ private Builder() { .putAll( BigtableStubSettings.defaultApiClientHeaderProviderBuilder().build().getHeaders()) // GrpcHeaderInterceptor treats the `user-agent` as a magic string - .put("user-agent", "bigtable-java/" + Version.VERSION) + .put("user-agent", "bigtable-java/" + ClientVersion.VERSION) .build(); setInternalHeaderProvider(FixedHeaderProvider.create(headers)); diff --git a/google-cloud-bigtable/src/main/templates/com/google/cloud/bigtable/Version.java b/google-cloud-bigtable/src/main/templates/com/google/cloud/bigtable/Version.java deleted file mode 100644 index 7f87f249dc..0000000000 --- a/google-cloud-bigtable/src/main/templates/com/google/cloud/bigtable/Version.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.cloud.bigtable; - -import com.google.api.core.InternalApi; - -@InternalApi("For internal use only") -public final class Version { - // The released version, populated by maven. - public static String VERSION = "${java-bigtable.version}"; -} From cc73977bc2cc178b8d0d361a28ca3131343a19c7 Mon Sep 17 00:00:00 2001 From: Igor Bernstein Date: Fri, 9 Apr 2021 17:23:58 -0400 Subject: [PATCH 3/7] rename back to Version --- .../cloud/bigtable/{ClientVersion.java => Version.java} | 2 +- .../cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java | 5 ++--- .../bigtable/data/v2/stub/EnhancedBigtableStubSettings.java | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) rename google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/{ClientVersion.java => Version.java} (96%) diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/ClientVersion.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/Version.java similarity index 96% rename from google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/ClientVersion.java rename to google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/Version.java index d7c3d80af3..9a18460b1d 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/ClientVersion.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/Version.java @@ -18,7 +18,7 @@ import com.google.api.core.InternalApi; @InternalApi("For internal use only") -public final class ClientVersion { +public final class Version { // {x-version-update-start:google-cloud-bigtable:current} public static String VERSION = "1.22.1-SNAPSHOT"; // {x-version-update-end} diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java index 121c6c0e72..902b86ffcd 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java @@ -21,7 +21,6 @@ import com.google.api.gax.batching.BatcherImpl; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.FixedCredentialsProvider; -import com.google.api.gax.core.GaxProperties; import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcRawCallableFactory; @@ -54,7 +53,7 @@ import com.google.bigtable.v2.ReadRowsResponse; import com.google.bigtable.v2.SampleRowKeysRequest; import com.google.bigtable.v2.SampleRowKeysResponse; -import com.google.cloud.bigtable.ClientVersion; +import com.google.cloud.bigtable.Version; import com.google.cloud.bigtable.data.v2.internal.RequestContext; import com.google.cloud.bigtable.data.v2.models.BulkMutation; import com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation; @@ -195,7 +194,7 @@ public static EnhancedBigtableStubSettings finalizeSettings( // Also annotate traces with library versions .put("gax", GaxGrpcProperties.getGaxGrpcVersion()) .put("grpc", GaxGrpcProperties.getGrpcVersion()) - .put("gapic", ClientVersion.VERSION) + .put("gapic", Version.VERSION) .build()), // Add OpenCensus Metrics MetricsTracerFactory.create(tagger, stats, attributes), diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java index baa7ff6a90..eaea47f4ef 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java @@ -31,7 +31,6 @@ import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.auth.Credentials; -import com.google.cloud.bigtable.ClientVersion; import com.google.cloud.bigtable.Version; import com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation; import com.google.cloud.bigtable.data.v2.models.KeyOffset; @@ -538,7 +537,7 @@ private Builder() { .putAll( BigtableStubSettings.defaultApiClientHeaderProviderBuilder().build().getHeaders()) // GrpcHeaderInterceptor treats the `user-agent` as a magic string - .put("user-agent", "bigtable-java/" + ClientVersion.VERSION) + .put("user-agent", "bigtable-java/" + Version.VERSION) .build(); setInternalHeaderProvider(FixedHeaderProvider.create(headers)); From 15c5517b8eb5582523c7a5644e9fd95932d4541c Mon Sep 17 00:00:00 2001 From: Igor Bernstein Date: Fri, 9 Apr 2021 17:27:29 -0400 Subject: [PATCH 4/7] config release-please for version bumps --- .github/release-please.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/release-please.yml b/.github/release-please.yml index dce2c84509..7442886ff0 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,4 @@ releaseType: java-yoshi -bumpMinorPreMajor: true \ No newline at end of file +bumpMinorPreMajor: true +extraFiles: + - google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/ClientVersion.java From 724053584a01f28487ed8dca869ad4b0446d97cd Mon Sep 17 00:00:00 2001 From: Igor Bernstein Date: Fri, 9 Apr 2021 17:30:02 -0400 Subject: [PATCH 5/7] make sure file doesnt get clobbered --- synth.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/synth.py b/synth.py index e26edaac07..bd1c6316c5 100644 --- a/synth.py +++ b/synth.py @@ -41,6 +41,8 @@ def main(): # todo remove once template is updated '.github/ISSUE_TEMPLATE/bug_report.md', 'CONTRIBUTING.md', + # needed for extraFiles + '.github/release-please.yml', ]) def generate_data_api(gapic): From efdbdbf7f735b8fe1b66a7e7d1a8b715734f09c2 Mon Sep 17 00:00:00 2001 From: Igor Bernstein Date: Mon, 12 Apr 2021 15:57:52 -0400 Subject: [PATCH 6/7] add a couple of tests --- .../google/cloud/bigtable/VersionTest.java | 37 ++++++++++ .../v2/stub/EnhancedBigtableStubTest.java | 67 +++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/VersionTest.java diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/VersionTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/VersionTest.java new file mode 100644 index 0000000000..cc8fa820ff --- /dev/null +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/VersionTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.bigtable; + +import static com.google.common.truth.Truth.assertThat; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** + * Smoke test to ensure that release tooling doesn't accidentally corrupt the version + */ +@RunWith(JUnit4.class) +public class VersionTest { + @Test + public void testVersion() { + assertThat(Version.VERSION) + .matches("\\d+\\.\\d+\\.\\d(?:-SNAPSHOT)?"); + + assertThat(Version.VERSION) + .isGreaterThan("1.22.0"); + } +} diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubTest.java index 194123b1bd..49e22087dd 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubTest.java @@ -18,11 +18,13 @@ import static com.google.common.truth.Truth.assertThat; import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.rpc.ServerStreamingCallable; import com.google.bigtable.v2.BigtableGrpc; import com.google.bigtable.v2.ReadRowsRequest; import com.google.bigtable.v2.ReadRowsResponse; import com.google.bigtable.v2.RowSet; +import com.google.cloud.bigtable.Version; import com.google.cloud.bigtable.admin.v2.internal.NameUtil; import com.google.cloud.bigtable.data.v2.BigtableDataSettings; import com.google.cloud.bigtable.data.v2.FakeServiceHelper; @@ -39,9 +41,24 @@ import io.grpc.ServerCall.Listener; import io.grpc.ServerCallHandler; import io.grpc.ServerInterceptor; +import io.grpc.internal.GrpcUtil; import io.grpc.stub.StreamObserver; +import io.opencensus.common.Scope; +import io.opencensus.trace.AttributeValue; +import io.opencensus.trace.Tracer; +import io.opencensus.trace.Tracing; +import io.opencensus.trace.export.SpanData; +import io.opencensus.trace.export.SpanExporter; +import io.opencensus.trace.export.SpanExporter.Handler; +import io.opencensus.trace.samplers.Samplers; import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; +import java.util.concurrent.SynchronousQueue; import java.util.concurrent.TimeUnit; import org.junit.After; import org.junit.Before; @@ -152,6 +169,56 @@ public void testUserAgent() throws InterruptedException { .containsMatch("bigtable-java/\\d+\\.\\d+\\.\\d+(?:-SNAPSHOT)?"); } + @Test + public void testSpanAttributes() throws InterruptedException { + final BlockingQueue spans = new ArrayBlockingQueue<>(100); + + // inject a temporary trace exporter + String handlerName = "stub-test-exporter"; + + Tracing.getExportComponent().getSpanExporter().registerHandler(handlerName, + new Handler() { + @Override + public void export(Collection collection) { + spans.addAll(collection); + } + }); + + SpanData foundSpanData = null; + // Issue the rpc and grab the span + try { + try (Scope ignored = Tracing.getTracer().spanBuilder("fake-parent-span") + .setSampler(Samplers.alwaysSample()) + .startScopedSpan()) { + enhancedBigtableStub.readRowCallable().call(Query.create("table-id").rowKey("row-key")); + } + + for (int i = 0; i < 100; i++) { + SpanData spanData = spans.poll(10, TimeUnit.SECONDS); + if ("Bigtable.ReadRow".equals(spanData.getName())) { + foundSpanData = spanData; + break; + } + } + } finally { + // cleanup + Tracing.getExportComponent().getSpanExporter().unregisterHandler(handlerName); + } + + // Examine the caught span + assertThat(foundSpanData).isNotNull(); + assertThat(foundSpanData.getAttributes().getAttributeMap()).containsEntry( + "gapic", AttributeValue.stringAttributeValue(Version.VERSION) + ); + assertThat(foundSpanData.getAttributes().getAttributeMap()).containsEntry( + "grpc", AttributeValue.stringAttributeValue(GrpcUtil.getGrpcBuildVersion().getImplementationVersion()) + ); + assertThat(foundSpanData.getAttributes().getAttributeMap()).containsEntry( + "gax", AttributeValue.stringAttributeValue(GaxGrpcProperties.getGaxGrpcVersion()) + ); + } + + private static class MetadataInterceptor implements ServerInterceptor { final BlockingQueue headers = Queues.newLinkedBlockingDeque(); From 3f8e752ef30a6a7081379d3bef919a00ae52f422 Mon Sep 17 00:00:00 2001 From: Igor Bernstein Date: Mon, 12 Apr 2021 16:43:56 -0400 Subject: [PATCH 7/7] fmt --- .../google/cloud/bigtable/VersionTest.java | 10 ++-- .../v2/stub/EnhancedBigtableStubTest.java | 51 +++++++++---------- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/VersionTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/VersionTest.java index cc8fa820ff..e07f7a4a5a 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/VersionTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/VersionTest.java @@ -21,17 +21,13 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** - * Smoke test to ensure that release tooling doesn't accidentally corrupt the version - */ +/** Smoke test to ensure that release tooling doesn't accidentally corrupt the version */ @RunWith(JUnit4.class) public class VersionTest { @Test public void testVersion() { - assertThat(Version.VERSION) - .matches("\\d+\\.\\d+\\.\\d(?:-SNAPSHOT)?"); + assertThat(Version.VERSION).matches("\\d+\\.\\d+\\.\\d(?:-SNAPSHOT)?"); - assertThat(Version.VERSION) - .isGreaterThan("1.22.0"); + assertThat(Version.VERSION).isGreaterThan("1.22.0"); } } diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubTest.java index 49e22087dd..36bb271ff0 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubTest.java @@ -45,20 +45,14 @@ import io.grpc.stub.StreamObserver; import io.opencensus.common.Scope; import io.opencensus.trace.AttributeValue; -import io.opencensus.trace.Tracer; import io.opencensus.trace.Tracing; import io.opencensus.trace.export.SpanData; -import io.opencensus.trace.export.SpanExporter; import io.opencensus.trace.export.SpanExporter.Handler; import io.opencensus.trace.samplers.Samplers; import java.io.IOException; -import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; -import java.util.List; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; -import java.util.concurrent.SynchronousQueue; import java.util.concurrent.TimeUnit; import org.junit.After; import org.junit.Before; @@ -176,20 +170,25 @@ public void testSpanAttributes() throws InterruptedException { // inject a temporary trace exporter String handlerName = "stub-test-exporter"; - Tracing.getExportComponent().getSpanExporter().registerHandler(handlerName, - new Handler() { - @Override - public void export(Collection collection) { - spans.addAll(collection); - } - }); + Tracing.getExportComponent() + .getSpanExporter() + .registerHandler( + handlerName, + new Handler() { + @Override + public void export(Collection collection) { + spans.addAll(collection); + } + }); SpanData foundSpanData = null; // Issue the rpc and grab the span try { - try (Scope ignored = Tracing.getTracer().spanBuilder("fake-parent-span") - .setSampler(Samplers.alwaysSample()) - .startScopedSpan()) { + try (Scope ignored = + Tracing.getTracer() + .spanBuilder("fake-parent-span") + .setSampler(Samplers.alwaysSample()) + .startScopedSpan()) { enhancedBigtableStub.readRowCallable().call(Query.create("table-id").rowKey("row-key")); } @@ -207,18 +206,18 @@ public void export(Collection collection) { // Examine the caught span assertThat(foundSpanData).isNotNull(); - assertThat(foundSpanData.getAttributes().getAttributeMap()).containsEntry( - "gapic", AttributeValue.stringAttributeValue(Version.VERSION) - ); - assertThat(foundSpanData.getAttributes().getAttributeMap()).containsEntry( - "grpc", AttributeValue.stringAttributeValue(GrpcUtil.getGrpcBuildVersion().getImplementationVersion()) - ); - assertThat(foundSpanData.getAttributes().getAttributeMap()).containsEntry( - "gax", AttributeValue.stringAttributeValue(GaxGrpcProperties.getGaxGrpcVersion()) - ); + assertThat(foundSpanData.getAttributes().getAttributeMap()) + .containsEntry("gapic", AttributeValue.stringAttributeValue(Version.VERSION)); + assertThat(foundSpanData.getAttributes().getAttributeMap()) + .containsEntry( + "grpc", + AttributeValue.stringAttributeValue( + GrpcUtil.getGrpcBuildVersion().getImplementationVersion())); + assertThat(foundSpanData.getAttributes().getAttributeMap()) + .containsEntry( + "gax", AttributeValue.stringAttributeValue(GaxGrpcProperties.getGaxGrpcVersion())); } - private static class MetadataInterceptor implements ServerInterceptor { final BlockingQueue headers = Queues.newLinkedBlockingDeque();