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 25
25
import static com .google .cloud .spanner .BuiltInMetricsConstant .GAX_METER_NAME ;
26
26
import static com .google .cloud .spanner .BuiltInMetricsConstant .INSTANCE_ID_KEY ;
27
27
import static com .google .cloud .spanner .BuiltInMetricsConstant .PROJECT_ID_KEY ;
28
+ import static com .google .cloud .spanner .BuiltInMetricsConstant .SPANNER_METER_NAME ;
28
29
import static com .google .cloud .spanner .BuiltInMetricsConstant .SPANNER_PROMOTED_RESOURCE_LABELS ;
29
30
import static com .google .cloud .spanner .BuiltInMetricsConstant .SPANNER_RESOURCE_TYPE ;
30
31
@@ -75,8 +76,8 @@ static List<TimeSeries> convertToSpannerTimeSeries(List<MetricData> collection)
75
76
List <TimeSeries > allTimeSeries = new ArrayList <>();
76
77
77
78
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 ) )) {
80
81
// Filter out metric data for instruments that are not part of the spanner metrics list
81
82
continue ;
82
83
}
Original file line number Diff line number Diff line change 44
44
45
45
@ Category (ParallelIntegrationTest .class )
46
46
@ 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")
48
48
public class ITBuiltInMetricsTest {
49
49
50
50
private static Database db ;
@@ -82,10 +82,12 @@ public void testBuiltinMetricsWithDefaultOTEL() throws Exception {
82
82
83
83
String metricFilter =
84
84
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\" "
87
89
+ " AND metric.labels.database=\" %s\" " ,
88
- "operation_latencies" , env . getTestHelper ().getInstanceId (), db .getId ());
90
+ "operation_latencies" , db . getId ().getInstanceId (). getInstance () , db .getId (). getDatabase ());
89
91
90
92
ListTimeSeriesRequest .Builder requestBuilder =
91
93
ListTimeSeriesRequest .newBuilder ()
You can’t perform that action at this time.
0 commit comments