Skip to content

Commit

Permalink
changed the host env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
surbhigarg92 committed Dec 5, 2024
1 parent 8ad2163 commit 24d6819
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ protected SpannerOptions(Builder builder) {
enableExtendedTracing = builder.enableExtendedTracing;
enableBuiltInMetrics = builder.enableBuiltInMetrics;
enableEndToEndTracing = builder.enableEndToEndTracing;
metricsHost = builder.metricsHost;
metricsHost = builder.spannerMonitoringHost;
}

/**
Expand Down Expand Up @@ -715,7 +715,7 @@ default boolean isEnableEndToEndTracing() {
return false;
}

default String getMetricsHost() {
default String getSpannerMonitoringHost() {
return null;
}
}
Expand All @@ -734,7 +734,7 @@ private static class SpannerEnvironmentImpl implements SpannerEnvironment {
private static final String SPANNER_ENABLE_END_TO_END_TRACING =
"SPANNER_ENABLE_END_TO_END_TRACING";
private static final String SPANNER_DISABLE_BUILTIN_METRICS = "SPANNER_DISABLE_BUILTIN_METRICS";
private static final String SPANNER_METRICS_HOST = "SPANNER_METRICS_HOST";
private static final String SPANNER_MONITORING_HOST = "SPANNER_MONITORING_HOST";

private SpannerEnvironmentImpl() {}

Expand Down Expand Up @@ -772,8 +772,8 @@ public boolean isEnableEndToEndTracing() {
}

@Override
public String getMetricsHost() {
return System.getenv(SPANNER_METRICS_HOST);
public String getSpannerMonitoringHost() {
return System.getenv(SPANNER_MONITORING_HOST);
}
}

Expand Down Expand Up @@ -840,7 +840,7 @@ public static class Builder
private boolean enableExtendedTracing = SpannerOptions.environment.isEnableExtendedTracing();
private boolean enableEndToEndTracing = SpannerOptions.environment.isEnableEndToEndTracing();
private boolean enableBuiltInMetrics = SpannerOptions.environment.isEnableBuiltInMetrics();
private String metricsHost = SpannerOptions.environment.getMetricsHost();
private String spannerMonitoringHost = SpannerOptions.environment.getSpannerMonitoringHost();

private static String createCustomClientLibToken(String token) {
return token + " " + ServiceOptions.getGoogApiClientLibName();
Expand Down Expand Up @@ -908,7 +908,7 @@ protected Builder() {
this.enableExtendedTracing = options.enableExtendedTracing;
this.enableBuiltInMetrics = options.enableBuiltInMetrics;
this.enableEndToEndTracing = options.enableEndToEndTracing;
this.metricsHost = options.metricsHost;
this.spannerMonitoringHost = options.metricsHost;
}

@Override
Expand Down Expand Up @@ -1432,8 +1432,8 @@ public Builder setBuiltInMetricsEnabled(boolean enableBuiltInMetrics) {
}

/** Sets the metrics host to be used for Built-in client side metrics */
public Builder setMetricsHost(String metricsHost) {
this.metricsHost = metricsHost;
public Builder setSpannerMonitoringHost(String spannerMonitoringHost) {
this.spannerMonitoringHost = spannerMonitoringHost;
return this;
}

Expand Down Expand Up @@ -1775,7 +1775,7 @@ public boolean isEnableBuiltInMetrics() {
}

/** Returns the override metrics Host. */
String getMetricsHost() {
String getSpannerMonitoringHost() {
return metricsHost;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -757,13 +757,13 @@ public void testEndToEndTracingEnablement() {
@Test
public void testMetricsHost() {
String metricsEndpoint = "test-endpoint:443";
assertNull(SpannerOptions.newBuilder().setProjectId("p").build().getMetricsHost());
assertNull(SpannerOptions.newBuilder().setProjectId("p").build().getSpannerMonitoringHost());
assertThat(
SpannerOptions.newBuilder()
.setProjectId("p")
.setMetricsHost(metricsEndpoint)
.setSpannerMonitoringHost(metricsEndpoint)
.build()
.getMetricsHost())
.getSpannerMonitoringHost())
.isEqualTo(metricsEndpoint);
}

Expand Down

0 comments on commit 24d6819

Please sign in to comment.