Skip to content

Commit 3cfa346

Browse files
committed
feat: client built in metrics
1 parent 1f53d38 commit 3cfa346

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,6 @@ private static class SpannerEnvironmentImpl implements SpannerEnvironment {
725725
"SPANNER_OPTIMIZER_STATISTICS_PACKAGE";
726726
private static final String SPANNER_ENABLE_EXTENDED_TRACING = "SPANNER_ENABLE_EXTENDED_TRACING";
727727
private static final String SPANNER_ENABLE_API_TRACING = "SPANNER_ENABLE_API_TRACING";
728-
private static final String SPANNER_ENABLE_BUILTIN_METRICS = "SPANNER_ENABLE_BUILTIN_METRICS";
729728
private static final String SPANNER_ENABLE_END_TO_END_TRACING =
730729
"SPANNER_ENABLE_END_TO_END_TRACING";
731730

@@ -754,13 +753,6 @@ public boolean isEnableApiTracing() {
754753
return Boolean.parseBoolean(System.getenv(SPANNER_ENABLE_API_TRACING));
755754
}
756755

757-
@Override
758-
public boolean isEnableBuiltInMetrics() {
759-
// The environment variable SPANNER_ENABLE_BUILTIN_METRICS is used for testing and will be
760-
// removed in the future.
761-
return Boolean.parseBoolean(System.getenv(SPANNER_ENABLE_BUILTIN_METRICS));
762-
}
763-
764756
@Override
765757
public boolean isEnableEndToEndTracing() {
766758
return Boolean.parseBoolean(System.getenv(SPANNER_ENABLE_END_TO_END_TRACING));
@@ -828,7 +820,7 @@ public static class Builder
828820
private OpenTelemetry openTelemetry;
829821
private boolean enableApiTracing = SpannerOptions.environment.isEnableApiTracing();
830822
private boolean enableExtendedTracing = SpannerOptions.environment.isEnableExtendedTracing();
831-
private boolean enableBuiltInMetrics = SpannerOptions.environment.isEnableBuiltInMetrics();
823+
private boolean enableBuiltInMetrics = true;
832824
private boolean enableEndToEndTracing = SpannerOptions.environment.isEnableEndToEndTracing();
833825

834826
private static String createCustomClientLibToken(String token) {
@@ -1410,8 +1402,9 @@ public Builder setEnableApiTracing(boolean enableApiTracing) {
14101402
return this;
14111403
}
14121404

1413-
/** Enabling this will enable built in metrics for each individual RPC execution. */
1414-
Builder setEnableBuiltInMetrics(boolean enableBuiltInMetrics) {
1405+
/** Sets whether to enable or disable built in metrics for Data client Operations.
1406+
* Built in metrics are enabled as default. */
1407+
public Builder setEnableBuiltInMetrics(boolean enableBuiltInMetrics) {
14151408
this.enableBuiltInMetrics = enableBuiltInMetrics;
14161409
return this;
14171410
}

0 commit comments

Comments
 (0)