File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
main/java/com/google/cloud/spanner
test/java/com/google/cloud/spanner/it Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 2525import static com .google .cloud .spanner .BuiltInMetricsConstant .GAX_METER_NAME ;
2626import static com .google .cloud .spanner .BuiltInMetricsConstant .INSTANCE_ID_KEY ;
2727import static com .google .cloud .spanner .BuiltInMetricsConstant .PROJECT_ID_KEY ;
28+ import static com .google .cloud .spanner .BuiltInMetricsConstant .SPANNER_METER_NAME ;
2829import static com .google .cloud .spanner .BuiltInMetricsConstant .SPANNER_PROMOTED_RESOURCE_LABELS ;
2930import static com .google .cloud .spanner .BuiltInMetricsConstant .SPANNER_RESOURCE_TYPE ;
3031
@@ -75,8 +76,8 @@ static List<TimeSeries> convertToSpannerTimeSeries(List<MetricData> collection)
7576 List <TimeSeries > allTimeSeries = new ArrayList <>();
7677
7778 for (MetricData metricData : collection ) {
78- // Get common metrics data from GAX library
79- if (!metricData .getInstrumentationScopeInfo ().getName ().equals (GAX_METER_NAME )) {
79+ // Get metrics data from GAX library and Spanner library
80+ if (!( metricData .getInstrumentationScopeInfo ().getName ().equals (GAX_METER_NAME ) || metricData . getInstrumentationScopeInfo (). getName (). equals ( SPANNER_METER_NAME ) )) {
8081 // Filter out metric data for instruments that are not part of the spanner metrics list
8182 continue ;
8283 }
Original file line number Diff line number Diff line change 4444
4545@ Category (ParallelIntegrationTest .class )
4646@ RunWith (JUnit4 .class )
47- @ Ignore ("Built-in Metrics are not GA'ed yet. Enable this test once the metrics are released" )
47+ // @Ignore("Built-in Metrics are not GA'ed yet. Enable this test once the metrics are released")
4848public class ITBuiltInMetricsTest {
4949
5050 private static Database db ;
@@ -82,10 +82,12 @@ public void testBuiltinMetricsWithDefaultOTEL() throws Exception {
8282
8383 String metricFilter =
8484 String .format (
85- "metric.type=\" spanner.googleapis.com/client/%s\" "
86- + "AND resource.labels.instance=\" %s\" AND metric.labels.method=\" Spanner.ExecuteStreamingSql\" "
85+ "metric.type=\" spanner.googleapis.com/client/%s\" "
86+ + " AND resource.type=\" spanner_instance\" "
87+ + " AND metric.labels.method=\" Spanner.Commit\" "
88+ + " AND resource.labels.instance_id=\" %s\" "
8789 + " AND metric.labels.database=\" %s\" " ,
88- "operation_latencies" , env . getTestHelper ().getInstanceId (), db .getId ());
90+ "operation_latencies" , db . getId ().getInstanceId (). getInstance () , db .getId (). getDatabase ());
8991
9092 ListTimeSeriesRequest .Builder requestBuilder =
9193 ListTimeSeriesRequest .newBuilder ()
You can’t perform that action at this time.
0 commit comments