Skip to content

Commit

Permalink
update undefined cluster to global
Browse files Browse the repository at this point in the history
  • Loading branch information
mutianf committed Aug 5, 2022
1 parent d8f6162 commit b219200
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 28 deletions.
6 changes: 3 additions & 3 deletions google-cloud-bigtable-stats/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,14 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-monitoring</artifactId>
<!-- exclude these dependencies since they are not used and are causing conflict in google-cloud-bigtable -->
<exclusions>
<exclusion>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<artifactId>google-http-client-gson</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-gson</artifactId>
<artifactId>google-http-client</artifactId>
</exclusion>
</exclusions>
</dependency>
Expand Down Expand Up @@ -132,6 +131,7 @@
<artifactId>jsr305</artifactId>
</dependency>

<!-- runtime dependency for native image integration test -->
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,8 @@ static TimeSeries convertTimeSeries(
List<LabelValue> labelValues = timeSeries.getLabelValues();
for (int i = 0; i < labelValues.size(); i++) {
if (PROMOTED_RESOURCE_LABELS.contains(labelKeys.get(i).getKey())) {
if (labelKeys.get(i).getKey().equals(BuiltinMeasureConstants.CLUSTER.getName())
&& labelValues.get(i).getValue().equals("undefined")) {
monitoredResourceBuilder.putLabels(labelKeys.get(i).getKey(), "global");
} else if (labelKeys.get(i).getKey().equals(BuiltinMeasureConstants.ZONE.getName())
&& labelValues.get(i).getValue().equals("undefined")) {
monitoredResourceBuilder.putLabels(labelKeys.get(i).getKey(), "global");
} else {
monitoredResourceBuilder.putLabels(
labelKeys.get(i).getKey(), labelValues.get(i).getValue());
}
monitoredResourceBuilder.putLabels(
labelKeys.get(i).getKey(), labelValues.get(i).getValue());
} else {
metricTagKeys.add(labelKeys.get(i));
metricTagValues.add(labelValues.get(i));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class BigtableStackdriverStatsExporter {
@GuardedBy("monitor")
private static BigtableStackdriverStatsExporter instance = null;

private static final Duration EXPORT_INTERVAL = Duration.create(60, 0);
private static final Duration EXPORT_INTERVAL = Duration.create(600, 0);
private static final String RESOURCE_TYPE = "bigtable_client_raw";

private final IntervalMetricReader intervalMetricReader;
Expand Down
20 changes: 10 additions & 10 deletions google-cloud-bigtable/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@
<artifactId>grpc-alts</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-gson</artifactId>
<scope>runtime</scope>
</dependency>
<!--
grpc-stub is needed directly by our tests and transitively by grpc-alts at runtime.
So it has to be declared as a direct dependency and to avoid overriding grpc-alts'
Expand Down Expand Up @@ -269,16 +279,6 @@
<artifactId>opencensus-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-gson</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class BuiltinMetricsTracer extends BigtableTracer {

// Monitored resource labels
private String tableId = "undefined";
private String zone = "undefined";
private String cluster = "undefined";
private String zone = "global";
private String cluster = "global";

// gfe stats
private AtomicLong gfeMissingHeaders = new AtomicLong(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ public void testMutateRowAttempts() {
// and when the record() is called in onOperationCompletion().
verify(statsRecorderWrapper, timeout(50).times(fakeService.getAttemptCounter().get() + 1))
.record(status.capture(), tableId.capture(), zone.capture(), cluster.capture());
assertThat(zone.getAllValues()).containsExactly("undefined", "undefined", ZONE, ZONE);
assertThat(cluster.getAllValues()).containsExactly("undefined", "undefined", CLUSTER, CLUSTER);
assertThat(zone.getAllValues()).containsExactly("global", "global", ZONE, ZONE);
assertThat(cluster.getAllValues()).containsExactly("global", "global", CLUSTER, CLUSTER);
assertThat(status.getAllValues()).containsExactly("UNAVAILABLE", "UNAVAILABLE", "OK", "OK");
}

Expand Down

0 comments on commit b219200

Please sign in to comment.