6060import com .google .cloud .bigtable .data .v2 .internal .csm .metrics .TableRemainingDeadline ;
6161import com .google .cloud .bigtable .data .v2 .internal .csm .metrics .TableRetryCount ;
6262import com .google .cloud .bigtable .data .v2 .internal .csm .metrics .TableServerLatency ;
63+ import com .google .cloud .bigtable .data .v2 .internal .csm .schema .ClientSchema ;
6364import com .google .cloud .bigtable .data .v2 .internal .csm .schema .TableSchema ;
6465import com .google .cloud .bigtable .data .v2 .models .AuthorizedViewId ;
6566import com .google .cloud .bigtable .data .v2 .models .Query ;
@@ -169,6 +170,14 @@ public class BuiltinMetricsTracerTest {
169170 .put (MetricLabels .APP_PROFILE_KEY , APP_PROFILE_ID )
170171 .build ();
171172
173+ private Attributes expectedClientSchemaBaseAttributes =
174+ Attributes .builder ()
175+ .put (TableSchema .BIGTABLE_PROJECT_ID_KEY , PROJECT_ID )
176+ .put (TableSchema .INSTANCE_ID_KEY , INSTANCE_ID )
177+ .put (MetricLabels .APP_PROFILE_KEY , APP_PROFILE_ID )
178+ .put (MetricLabels .CLIENT_NAME , "java-bigtable/" + Version .VERSION )
179+ .build ();
180+
172181 private InMemoryMetricReader metricReader ;
173182
174183 private DelayProxyDetector delayProxyDetector ;
@@ -395,6 +404,7 @@ public void testGfeMetrics() {
395404 .put (TableSchema .CLUSTER_ID_KEY , CLUSTER )
396405 .put (MetricLabels .CLIENT_NAME , CLIENT_NAME )
397406 .put (MetricLabels .METHOD_KEY , "Bigtable.ReadRows" )
407+ .put (MetricLabels .STREAMING_KEY , true )
398408 .build ();
399409
400410 MetricData serverLatenciesMetricData = getMetricData (metricReader , TableServerLatency .NAME );
@@ -405,7 +415,7 @@ public void testGfeMetrics() {
405415 MetricData connectivityErrorCountMetricData =
406416 getMetricData (metricReader , TableConnectivityErrorCount .NAME );
407417 Attributes expected1 =
408- expectedBaseAttributes .toBuilder ()
418+ expectedClientSchemaBaseAttributes .toBuilder ()
409419 .put (MetricLabels .STATUS_KEY , "UNAVAILABLE" )
410420 .put (TableSchema .TABLE_ID_KEY , TABLE )
411421 .put (TableSchema .ZONE_ID_KEY , "global" )
@@ -414,7 +424,7 @@ public void testGfeMetrics() {
414424 .put (MetricLabels .CLIENT_NAME , CLIENT_NAME )
415425 .build ();
416426 Attributes expected2 =
417- expectedBaseAttributes .toBuilder ()
427+ expectedClientSchemaBaseAttributes .toBuilder ()
418428 .put (MetricLabels .STATUS_KEY , "OK" )
419429 .put (TableSchema .TABLE_ID_KEY , TABLE )
420430 .put (TableSchema .ZONE_ID_KEY , ZONE )
@@ -842,7 +852,7 @@ public void testBatchWriteFlowControlTargetQpsIncreased() throws InterruptedExce
842852 MetricData targetQpsMetric =
843853 getMetricData (metricReader , ClientBatchWriteFlowControlTargetQps .NAME );
844854 Attributes targetQpsAttributes =
845- expectedBaseAttributes .toBuilder ()
855+ expectedClientSchemaBaseAttributes .toBuilder ()
846856 .put (MetricLabels .METHOD_KEY , "Bigtable.MutateRows" )
847857 .build ();
848858 double actual_qps = getAggregatedDoubleValue (targetQpsMetric , targetQpsAttributes );
@@ -851,7 +861,8 @@ public void testBatchWriteFlowControlTargetQpsIncreased() throws InterruptedExce
851861
852862 MetricData factorMetric = getMetricData (metricReader , ClientBatchWriteFlowControlFactor .NAME );
853863 Attributes factorAttributes =
854- expectedBaseAttributes .toBuilder ()
864+ expectedClientSchemaBaseAttributes .toBuilder ()
865+ .put (ClientSchema .CLIENT_NAME , "java-bigtable/" + Version .VERSION )
855866 .put (MetricLabels .METHOD_KEY , "Bigtable.MutateRows" )
856867 .put (MetricLabels .APPLIED_KEY , true )
857868 .put (MetricLabels .STATUS_KEY , "OK" )
@@ -874,7 +885,7 @@ public void testBatchWriteFlowControlTargetQpsDecreased() throws InterruptedExce
874885 MetricData targetQpsMetric =
875886 getMetricData (metricReader , ClientBatchWriteFlowControlTargetQps .NAME );
876887 Attributes targetQpsAttributes =
877- expectedBaseAttributes .toBuilder ()
888+ expectedClientSchemaBaseAttributes .toBuilder ()
878889 .put (MetricLabels .METHOD_KEY , "Bigtable.MutateRows" )
879890 .build ();
880891 double actual_qps = getAggregatedDoubleValue (targetQpsMetric , targetQpsAttributes );
@@ -883,7 +894,7 @@ public void testBatchWriteFlowControlTargetQpsDecreased() throws InterruptedExce
883894
884895 MetricData factorMetric = getMetricData (metricReader , ClientBatchWriteFlowControlFactor .NAME );
885896 Attributes factorAttributes =
886- expectedBaseAttributes .toBuilder ()
897+ expectedClientSchemaBaseAttributes .toBuilder ()
887898 .put (MetricLabels .METHOD_KEY , "Bigtable.MutateRows" )
888899 .put (MetricLabels .APPLIED_KEY , true )
889900 .put (MetricLabels .STATUS_KEY , "OK" )
@@ -906,7 +917,7 @@ public void testBatchWriteFlowControlTargetQpsCappedOnMaxFactor() throws Interru
906917 MetricData targetQpsMetric =
907918 getMetricData (metricReader , ClientBatchWriteFlowControlTargetQps .NAME );
908919 Attributes targetQpsAttributes =
909- expectedBaseAttributes .toBuilder ()
920+ expectedClientSchemaBaseAttributes .toBuilder ()
910921 .put (MetricLabels .METHOD_KEY , "Bigtable.MutateRows" )
911922 .build ();
912923 double actual_qps = getAggregatedDoubleValue (targetQpsMetric , targetQpsAttributes );
@@ -916,7 +927,7 @@ public void testBatchWriteFlowControlTargetQpsCappedOnMaxFactor() throws Interru
916927
917928 MetricData factorMetric = getMetricData (metricReader , ClientBatchWriteFlowControlFactor .NAME );
918929 Attributes factorAttributes =
919- expectedBaseAttributes .toBuilder ()
930+ expectedClientSchemaBaseAttributes .toBuilder ()
920931 .put (MetricLabels .METHOD_KEY , "Bigtable.MutateRows" )
921932 .put (MetricLabels .APPLIED_KEY , true )
922933 .put (MetricLabels .STATUS_KEY , "OK" )
@@ -940,7 +951,7 @@ public void testBatchWriteFlowControlTargetQpsCappedOnMinFactor() throws Interru
940951 MetricData targetQpsMetric =
941952 getMetricData (metricReader , ClientBatchWriteFlowControlTargetQps .NAME );
942953 Attributes targetQpsAttributes =
943- expectedBaseAttributes .toBuilder ()
954+ expectedClientSchemaBaseAttributes .toBuilder ()
944955 .put (MetricLabels .METHOD_KEY , "Bigtable.MutateRows" )
945956 .build ();
946957 double actual_qps = getAggregatedDoubleValue (targetQpsMetric , targetQpsAttributes );
@@ -950,7 +961,7 @@ public void testBatchWriteFlowControlTargetQpsCappedOnMinFactor() throws Interru
950961
951962 MetricData factorMetric = getMetricData (metricReader , ClientBatchWriteFlowControlFactor .NAME );
952963 Attributes factorAttributes =
953- expectedBaseAttributes .toBuilder ()
964+ expectedClientSchemaBaseAttributes .toBuilder ()
954965 .put (MetricLabels .METHOD_KEY , "Bigtable.MutateRows" )
955966 .put (MetricLabels .APPLIED_KEY , true )
956967 .put (MetricLabels .STATUS_KEY , "OK" )
@@ -975,7 +986,7 @@ public void testBatchWriteFlowControlTargetQpsDecreasedForError() throws Interru
975986 MetricData targetQpsMetric =
976987 getMetricData (metricReader , ClientBatchWriteFlowControlTargetQps .NAME );
977988 Attributes targetQpsAttributes =
978- expectedBaseAttributes .toBuilder ()
989+ expectedClientSchemaBaseAttributes .toBuilder ()
979990 .put (MetricLabels .METHOD_KEY , "Bigtable.MutateRows" )
980991 .build ();
981992 double actual_qps = getAggregatedDoubleValue (targetQpsMetric , targetQpsAttributes );
@@ -985,7 +996,7 @@ public void testBatchWriteFlowControlTargetQpsDecreasedForError() throws Interru
985996
986997 MetricData factorMetric = getMetricData (metricReader , ClientBatchWriteFlowControlFactor .NAME );
987998 Attributes factorAttributes =
988- expectedBaseAttributes .toBuilder ()
999+ expectedClientSchemaBaseAttributes .toBuilder ()
9891000 .put (MetricLabels .METHOD_KEY , "Bigtable.MutateRows" )
9901001 .put (MetricLabels .APPLIED_KEY , true )
9911002 .put (MetricLabels .STATUS_KEY , "UNAVAILABLE" )
0 commit comments