Skip to content

Commit

Permalink
tweak export interval
Browse files Browse the repository at this point in the history
  • Loading branch information
mutianf committed Aug 9, 2022
1 parent a5530dd commit 8feaeec
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public class BigtableStackdriverStatsExporter {
static final Object lock = new Object();

@Nullable
@GuardedBy("monitor")
@GuardedBy("lock")
private static BigtableStackdriverStatsExporter instance = null;

// Default export interval is 10 minutes
private static final Duration EXPORT_INTERVAL = Duration.create(600, 0);
// Default export interval is 5 minutes
private static final Duration EXPORT_INTERVAL = Duration.create(60 * 5, 0);
private static final String RESOURCE_TYPE = "bigtable_client_raw";

private final IntervalMetricReader intervalMetricReader;
Expand All @@ -65,8 +65,7 @@ private BigtableStackdriverStatsExporter(
intervalMetricReaderOptionsBuilder.build());
}

public static void register(@Nullable Credentials credentials, String projectId)
throws IOException {
public static void register(Credentials credentials, String projectId) throws IOException {
synchronized (lock) {
Preconditions.checkState(
instance == null, "Bigtable Stackdriver stats exporter is already created");
Expand All @@ -79,16 +78,14 @@ public static void register(@Nullable Credentials credentials, String projectId)
}
}

@GuardedBy("monitor")
@GuardedBy("lock")
@VisibleForTesting
static MetricServiceClient createMetricServiceClient(
@Nullable Credentials credentials, Duration deadline) throws IOException {
static MetricServiceClient createMetricServiceClient(Credentials credentials, Duration deadline)
throws IOException {
MetricServiceSettings.Builder settingsBuilder =
MetricServiceSettings.newBuilder()
.setTransportChannelProvider(InstantiatingGrpcChannelProvider.newBuilder().build());
if (credentials != null) {
settingsBuilder.setCredentialsProvider(FixedCredentialsProvider.create(credentials));
}
settingsBuilder.setCredentialsProvider(FixedCredentialsProvider.create(credentials));

org.threeten.bp.Duration stackdriverDuration =
org.threeten.bp.Duration.ofMillis(deadline.toMillis());
Expand Down

0 comments on commit 8feaeec

Please sign in to comment.