Skip to content

Commit

Permalink
include version
Browse files Browse the repository at this point in the history
  • Loading branch information
mutianf committed Mar 19, 2024
1 parent 970f4f7 commit 29cd9ae
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import com.google.api.gax.retrying.ServerStreamingAttemptException;
import com.google.api.gax.tracing.SpanName;
import com.google.cloud.bigtable.Version;
import com.google.common.base.Stopwatch;
import com.google.common.math.IntMath;
import io.opentelemetry.api.common.Attributes;
Expand All @@ -45,7 +46,7 @@
*/
class BuiltinMetricsTracer extends BigtableTracer {

private static final String NAME = "java-bigtable";
private static final String NAME = "java-bigtable/" + Version.VERSION;
private final OperationType operationType;
private final SpanName spanName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import com.google.bigtable.v2.ReadRowsRequest;
import com.google.bigtable.v2.ReadRowsResponse;
import com.google.bigtable.v2.ResponseParams;
import com.google.cloud.bigtable.Version;
import com.google.cloud.bigtable.data.v2.BigtableDataSettings;
import com.google.cloud.bigtable.data.v2.FakeServiceBuilder;
import com.google.cloud.bigtable.data.v2.models.Query;
Expand Down Expand Up @@ -125,6 +126,7 @@ public class BuiltinMetricsTracerTest {
private static final long SERVER_LATENCY = 100;
private static final long APPLICATION_LATENCY = 200;
private static final long SLEEP_VARIABILITY = 15;
private static final String CLIENT_NAME = "java-bigtable/" + Version.VERSION;

private static final long CHANNEL_BLOCKING_LATENCY = 75;

Expand Down Expand Up @@ -289,7 +291,7 @@ public void testReadRowsOperationLatencies() {
.put(CLUSTER_ID_KEY, CLUSTER)
.put(METHOD_KEY, "Bigtable.ReadRows")
.put(STREAMING_KEY, true)
.put(CLIENT_NAME_KEY, "java-bigtable")
.put(CLIENT_NAME_KEY, CLIENT_NAME)
.build();

Collection<MetricData> allMetricData = metricReader.collectAllMetrics();
Expand All @@ -311,7 +313,7 @@ public void testGfeMetrics() {
.put(TABLE_ID_KEY, TABLE)
.put(ZONE_ID_KEY, ZONE)
.put(CLUSTER_ID_KEY, CLUSTER)
.put(CLIENT_NAME_KEY, "java-bigtable")
.put(CLIENT_NAME_KEY, CLIENT_NAME)
.put(METHOD_KEY, "Bigtable.ReadRows")
.build();

Expand All @@ -332,7 +334,7 @@ public void testGfeMetrics() {
.put(ZONE_ID_KEY, "global")
.put(CLUSTER_ID_KEY, "unspecified")
.put(METHOD_KEY, "Bigtable.ReadRows")
.put(CLIENT_NAME_KEY, "java-bigtable")
.put(CLIENT_NAME_KEY, CLIENT_NAME)
.build();
Attributes expected2 =
baseAttributes
Expand All @@ -342,7 +344,7 @@ public void testGfeMetrics() {
.put(ZONE_ID_KEY, ZONE)
.put(CLUSTER_ID_KEY, CLUSTER)
.put(METHOD_KEY, "Bigtable.ReadRows")
.put(CLIENT_NAME_KEY, "java-bigtable")
.put(CLIENT_NAME_KEY, CLIENT_NAME)
.build();

verifyAttributes(connectivityErrorCountMetricData, expected1);
Expand Down Expand Up @@ -397,7 +399,7 @@ public void onComplete() {
.put(TABLE_ID_KEY, TABLE)
.put(ZONE_ID_KEY, ZONE)
.put(CLUSTER_ID_KEY, CLUSTER)
.put(CLIENT_NAME_KEY, "java-bigtable")
.put(CLIENT_NAME_KEY, CLIENT_NAME)
.put(METHOD_KEY, "Bigtable.ReadRows")
.build();
long value = getAggregatedValue(applicationLatency, expectedAttributes);
Expand Down Expand Up @@ -434,7 +436,7 @@ public void testReadRowsApplicationLatencyWithManualFlowControl() throws Excepti
.put(TABLE_ID_KEY, TABLE)
.put(ZONE_ID_KEY, ZONE)
.put(CLUSTER_ID_KEY, CLUSTER)
.put(CLIENT_NAME_KEY, "java-bigtable")
.put(CLIENT_NAME_KEY, CLIENT_NAME)
.put(METHOD_KEY, "Bigtable.ReadRows")
.build();

Expand Down Expand Up @@ -465,7 +467,7 @@ public void testRetryCount() throws InterruptedException {
.put(TABLE_ID_KEY, TABLE)
.put(ZONE_ID_KEY, ZONE)
.put(CLUSTER_ID_KEY, CLUSTER)
.put(CLIENT_NAME_KEY, "java-bigtable")
.put(CLIENT_NAME_KEY, CLIENT_NAME)
.put(METHOD_KEY, "Bigtable.MutateRow")
.put(STATUS_KEY, "OK")
.build();
Expand All @@ -490,7 +492,7 @@ public void testMutateRowAttemptsTagValues() {
.put(ZONE_ID_KEY, "global")
.put(CLUSTER_ID_KEY, "unspecified")
.put(METHOD_KEY, "Bigtable.MutateRow")
.put(CLIENT_NAME_KEY, "java-bigtable")
.put(CLIENT_NAME_KEY, CLIENT_NAME)
.put(STREAMING_KEY, false)
.build();

Expand All @@ -502,7 +504,7 @@ public void testMutateRowAttemptsTagValues() {
.put(ZONE_ID_KEY, ZONE)
.put(CLUSTER_ID_KEY, CLUSTER)
.put(METHOD_KEY, "Bigtable.MutateRow")
.put(CLIENT_NAME_KEY, "java-bigtable")
.put(CLIENT_NAME_KEY, CLIENT_NAME)
.put(STREAMING_KEY, false)
.build();

Expand All @@ -525,7 +527,7 @@ public void testReadRowsAttemptsTagValues() {
.put(ZONE_ID_KEY, "global")
.put(CLUSTER_ID_KEY, "unspecified")
.put(METHOD_KEY, "Bigtable.ReadRows")
.put(CLIENT_NAME_KEY, "java-bigtable")
.put(CLIENT_NAME_KEY, CLIENT_NAME)
.put(STREAMING_KEY, true)
.build();

Expand All @@ -537,7 +539,7 @@ public void testReadRowsAttemptsTagValues() {
.put(ZONE_ID_KEY, ZONE)
.put(CLUSTER_ID_KEY, CLUSTER)
.put(METHOD_KEY, "Bigtable.ReadRows")
.put(CLIENT_NAME_KEY, "java-bigtable")
.put(CLIENT_NAME_KEY, CLIENT_NAME)
.put(STREAMING_KEY, true)
.build();

Expand Down Expand Up @@ -567,7 +569,7 @@ public void testBatchBlockingLatencies() throws InterruptedException {
.put(ZONE_ID_KEY, ZONE)
.put(CLUSTER_ID_KEY, CLUSTER)
.put(METHOD_KEY, "Bigtable.MutateRows")
.put(CLIENT_NAME_KEY, "java-bigtable")
.put(CLIENT_NAME_KEY, CLIENT_NAME)
.build();

long value = getAggregatedValue(applicationLatency, expectedAttributes);
Expand All @@ -593,7 +595,7 @@ public void testQueuedOnChannelServerStreamLatencies() {
.put(CLUSTER_ID_KEY, CLUSTER)
.put(ZONE_ID_KEY, ZONE)
.put(METHOD_KEY, "Bigtable.ReadRows")
.put(CLIENT_NAME_KEY, "java-bigtable")
.put(CLIENT_NAME_KEY, CLIENT_NAME)
.build();

long value = getAggregatedValue(clientLatency, attributes);
Expand All @@ -615,7 +617,7 @@ public void testQueuedOnChannelUnaryLatencies() {
.put(CLUSTER_ID_KEY, CLUSTER)
.put(ZONE_ID_KEY, ZONE)
.put(METHOD_KEY, "Bigtable.MutateRow")
.put(CLIENT_NAME_KEY, "java-bigtable")
.put(CLIENT_NAME_KEY, CLIENT_NAME)
.build();

long expected = CHANNEL_BLOCKING_LATENCY * 2 / 3;
Expand Down Expand Up @@ -643,7 +645,7 @@ public void testPermanentFailure() {
.put(ZONE_ID_KEY, "global")
.put(STREAMING_KEY, true)
.put(METHOD_KEY, "Bigtable.ReadRows")
.put(CLIENT_NAME_KEY, "java-bigtable")
.put(CLIENT_NAME_KEY, CLIENT_NAME)
.build();

verifyAttributes(attemptLatency, expected);
Expand Down

0 comments on commit 29cd9ae

Please sign in to comment.