Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: append version to the client name in client-side metrics. #2062

Merged
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -50,7 +50,7 @@ If you are using Maven without the BOM, add this to your dependencies:
If you are using Gradle 5.x or later, add this to your dependencies:

```Groovy
implementation platform('com.google.cloud:libraries-bom:26.29.0')
implementation platform('com.google.cloud:libraries-bom:26.30.0')

implementation 'com.google.cloud:google-cloud-bigtable'
```
Expand Down
Expand Up @@ -123,7 +123,6 @@ private TagContextBuilder newTagContextBuilder(String tableId, String zone, Stri
TagContextBuilder tagContextBuilder =
tagger
.toBuilder(parentContext)
.putLocal(BuiltinMeasureConstants.CLIENT_NAME, TagValue.create("bigtable-java"))
.putLocal(BuiltinMeasureConstants.METHOD, TagValue.create(spanName.toString()))
.putLocal(BuiltinMeasureConstants.TABLE, TagValue.create(tableId))
.putLocal(BuiltinMeasureConstants.ZONE, TagValue.create(zone))
Expand Down
Expand Up @@ -51,6 +51,7 @@ public class StatsRecorderWrapperTest {
private final String TABLE_ID = "fake-table-id";
private final String ZONE = "fake-zone";
private final String CLUSTER = "fake-cluster";
private final String CLIENT_AND_VERSION = "bigtable-java/fake-version";

private final StatsComponent statsComponent = new StatsComponentImpl();

Expand All @@ -72,7 +73,9 @@ public void testStreamingOperation() throws InterruptedException {
BuiltinMeasureConstants.INSTANCE_ID.getName(),
INSTANCE_ID,
BuiltinMeasureConstants.APP_PROFILE.getName(),
APP_PROFILE_ID),
APP_PROFILE_ID,
BuiltinMeasureConstants.CLIENT_NAME.getName(),
CLIENT_AND_VERSION),
statsComponent.getStatsRecorder());

long operationLatency = 1234;
Expand Down Expand Up @@ -107,7 +110,7 @@ public void testStreamingOperation() throws InterruptedException {
BuiltinMeasureConstants.TABLE, TABLE_ID,
BuiltinMeasureConstants.ZONE, ZONE,
BuiltinMeasureConstants.CLUSTER, CLUSTER,
BuiltinMeasureConstants.CLIENT_NAME, "bigtable-java",
BuiltinMeasureConstants.CLIENT_NAME, CLIENT_AND_VERSION,
BuiltinMeasureConstants.STREAMING, "true"),
PROJECT_ID,
INSTANCE_ID,
Expand All @@ -129,7 +132,7 @@ public void testStreamingOperation() throws InterruptedException {
BuiltinMeasureConstants.CLUSTER,
CLUSTER,
BuiltinMeasureConstants.CLIENT_NAME,
"bigtable-java",
CLIENT_AND_VERSION,
BuiltinMeasureConstants.STREAMING,
"true"),
PROJECT_ID,
Expand All @@ -152,7 +155,7 @@ public void testStreamingOperation() throws InterruptedException {
BuiltinMeasureConstants.CLUSTER,
CLUSTER,
BuiltinMeasureConstants.CLIENT_NAME,
"bigtable-java"),
CLIENT_AND_VERSION),
PROJECT_ID,
INSTANCE_ID,
APP_PROFILE_ID,
Expand All @@ -167,7 +170,7 @@ public void testStreamingOperation() throws InterruptedException {
BuiltinMeasureConstants.STATUS,
"OK",
BuiltinMeasureConstants.CLIENT_NAME,
"bigtable-java",
CLIENT_AND_VERSION,
BuiltinMeasureConstants.STREAMING,
"true",
BuiltinMeasureConstants.TABLE,
Expand Down Expand Up @@ -196,7 +199,7 @@ public void testStreamingOperation() throws InterruptedException {
BuiltinMeasureConstants.CLUSTER,
CLUSTER,
BuiltinMeasureConstants.CLIENT_NAME,
"bigtable-java",
CLIENT_AND_VERSION,
BuiltinMeasureConstants.STREAMING,
"true"),
PROJECT_ID,
Expand All @@ -213,7 +216,7 @@ public void testStreamingOperation() throws InterruptedException {
BuiltinMeasureConstants.STATUS,
"OK",
BuiltinMeasureConstants.CLIENT_NAME,
"bigtable-java",
CLIENT_AND_VERSION,
BuiltinMeasureConstants.TABLE,
TABLE_ID,
BuiltinMeasureConstants.ZONE,
Expand All @@ -233,7 +236,7 @@ public void testStreamingOperation() throws InterruptedException {
BuiltinMeasureConstants.TABLE, TABLE_ID,
BuiltinMeasureConstants.ZONE, ZONE,
BuiltinMeasureConstants.CLUSTER, CLUSTER,
BuiltinMeasureConstants.CLIENT_NAME, "bigtable-java"),
BuiltinMeasureConstants.CLIENT_NAME, CLIENT_AND_VERSION),
PROJECT_ID,
INSTANCE_ID,
APP_PROFILE_ID,
Expand All @@ -254,7 +257,7 @@ public void testStreamingOperation() throws InterruptedException {
BuiltinMeasureConstants.STATUS,
"OK",
BuiltinMeasureConstants.CLIENT_NAME,
"bigtable-java"),
CLIENT_AND_VERSION),
PROJECT_ID,
INSTANCE_ID,
APP_PROFILE_ID,
Expand All @@ -271,7 +274,8 @@ public void testUnaryOperations() throws InterruptedException {
ImmutableMap.of(
BuiltinMeasureConstants.PROJECT_ID.getName(), PROJECT_ID,
BuiltinMeasureConstants.INSTANCE_ID.getName(), INSTANCE_ID,
BuiltinMeasureConstants.APP_PROFILE.getName(), APP_PROFILE_ID),
BuiltinMeasureConstants.APP_PROFILE.getName(), APP_PROFILE_ID,
BuiltinMeasureConstants.CLIENT_NAME.getName(), CLIENT_AND_VERSION),
statsComponent.getStatsRecorder());

long operationLatency = 1234;
Expand Down Expand Up @@ -312,7 +316,7 @@ public void testUnaryOperations() throws InterruptedException {
BuiltinMeasureConstants.CLUSTER,
CLUSTER,
BuiltinMeasureConstants.CLIENT_NAME,
"bigtable-java",
CLIENT_AND_VERSION,
BuiltinMeasureConstants.STREAMING,
"false"),
PROJECT_ID,
Expand All @@ -335,7 +339,7 @@ public void testUnaryOperations() throws InterruptedException {
BuiltinMeasureConstants.CLUSTER,
CLUSTER,
BuiltinMeasureConstants.CLIENT_NAME,
"bigtable-java",
CLIENT_AND_VERSION,
BuiltinMeasureConstants.STREAMING,
"false"),
PROJECT_ID,
Expand All @@ -358,7 +362,7 @@ public void testUnaryOperations() throws InterruptedException {
BuiltinMeasureConstants.CLUSTER,
CLUSTER,
BuiltinMeasureConstants.CLIENT_NAME,
"bigtable-java"),
CLIENT_AND_VERSION),
PROJECT_ID,
INSTANCE_ID,
APP_PROFILE_ID,
Expand All @@ -373,7 +377,7 @@ public void testUnaryOperations() throws InterruptedException {
BuiltinMeasureConstants.STATUS,
"UNAVAILABLE",
BuiltinMeasureConstants.CLIENT_NAME,
"bigtable-java",
CLIENT_AND_VERSION,
BuiltinMeasureConstants.STREAMING,
"false",
BuiltinMeasureConstants.TABLE,
Expand Down Expand Up @@ -402,7 +406,7 @@ public void testUnaryOperations() throws InterruptedException {
BuiltinMeasureConstants.CLUSTER,
CLUSTER,
BuiltinMeasureConstants.CLIENT_NAME,
"bigtable-java",
CLIENT_AND_VERSION,
BuiltinMeasureConstants.STREAMING,
"false"),
PROJECT_ID,
Expand All @@ -419,7 +423,7 @@ public void testUnaryOperations() throws InterruptedException {
BuiltinMeasureConstants.STATUS,
"UNAVAILABLE",
BuiltinMeasureConstants.CLIENT_NAME,
"bigtable-java",
CLIENT_AND_VERSION,
BuiltinMeasureConstants.TABLE,
TABLE_ID,
BuiltinMeasureConstants.ZONE,
Expand All @@ -439,7 +443,7 @@ public void testUnaryOperations() throws InterruptedException {
BuiltinMeasureConstants.TABLE, TABLE_ID,
BuiltinMeasureConstants.ZONE, ZONE,
BuiltinMeasureConstants.CLUSTER, CLUSTER,
BuiltinMeasureConstants.CLIENT_NAME, "bigtable-java"),
BuiltinMeasureConstants.CLIENT_NAME, CLIENT_AND_VERSION),
PROJECT_ID,
INSTANCE_ID,
APP_PROFILE_ID,
Expand All @@ -460,7 +464,7 @@ public void testUnaryOperations() throws InterruptedException {
BuiltinMeasureConstants.STATUS,
"UNAVAILABLE",
BuiltinMeasureConstants.CLIENT_NAME,
"bigtable-java"),
CLIENT_AND_VERSION),
PROJECT_ID,
INSTANCE_ID,
APP_PROFILE_ID,
Expand Down
Expand Up @@ -259,6 +259,7 @@ public static ApiTracerFactory createBigtableTracerFactory(
.put("project_id", projectId)
.put("instance", instanceId)
.put("app_profile", appProfileId)
.put("client_name", "bigtable-java/" + Version.VERSION)
.build();

return new CompositeTracerFactory(
Expand Down