Skip to content
This repository was archived by the owner on Dec 23, 2023. It is now read-only.

Commit 281e94d

Browse files
authored
Exporter/Stackdriver: Fix stale document on interval. (#1950)
1 parent 67c6f93 commit 281e94d

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

exporters/stats/stackdriver/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ StackdriverStatsExporter.createAndRegister(
122122
StackdriverStatsConfiguration.builder()
123123
.setCredentials(new GoogleCredentials(new AccessToken(accessToken, expirationTime)))
124124
.setProjectId("MyStackdriverProjectId")
125-
.setExportInterval(Duration.create(10, 0))
125+
.setExportInterval(Duration.create(60, 0))
126126
.build());
127127
```
128128

exporters/stats/stackdriver/src/main/java/io/opencensus/exporter/stats/stackdriver/StackdriverStatsConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public abstract class StackdriverStatsConfiguration {
4848
static final MonitoredResource DEFAULT_RESOURCE = StackdriverExportUtils.getDefaultResource();
4949
static final String DEFAULT_PROJECT_ID =
5050
Strings.nullToEmpty(ServiceOptions.getDefaultProjectId());
51-
static final Duration DEFAULT_DEADLINE = Duration.create(10, 0);
51+
static final Duration DEFAULT_DEADLINE = Duration.create(60, 0);
5252

5353
StackdriverStatsConfiguration() {}
5454

exporters/stats/stackdriver/src/test/java/io/opencensus/exporter/stats/stackdriver/StackdriverStatsConfigurationTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public class StackdriverStatsConfigurationTest {
4848
private static final Credentials FAKE_CREDENTIALS =
4949
GoogleCredentials.newBuilder().setAccessToken(new AccessToken("fake", new Date(100))).build();
5050
private static final String PROJECT_ID = "project";
51-
private static final Duration DURATION = Duration.create(10, 0);
52-
private static final Duration NEG_ONE_SECOND = Duration.create(-1, 0);
51+
private static final Duration DURATION = Duration.create(60, 0);
52+
private static final Duration NEG_ONE_MINUTE = Duration.create(-60, 0);
5353
private static final MonitoredResource RESOURCE =
5454
MonitoredResource.newBuilder()
5555
.setType("gce-instance")
@@ -210,7 +210,7 @@ public void disallowZeroDuration() {
210210
public void disallowNegativeDuration() {
211211
StackdriverStatsConfiguration.Builder builder =
212212
StackdriverStatsConfiguration.builder().setProjectId("test");
213-
builder.setDeadline(NEG_ONE_SECOND);
213+
builder.setDeadline(NEG_ONE_MINUTE);
214214
thrown.expect(IllegalArgumentException.class);
215215
builder.build();
216216
}

exporters/stats/stackdriver/src/test/java/io/opencensus/exporter/stats/stackdriver/StackdriverStatsExporterTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
public class StackdriverStatsExporterTest {
4040

4141
private static final String PROJECT_ID = "projectId";
42-
private static final Duration ONE_SECOND = Duration.create(1, 0);
43-
private static final Duration NEG_ONE_SECOND = Duration.create(-1, 0);
42+
private static final Duration ONE_MINUTE = Duration.create(60, 0);
43+
private static final Duration NEG_ONE_MINUTE = Duration.create(-60, 0);
4444
private static final Credentials FAKE_CREDENTIALS =
4545
GoogleCredentials.newBuilder().setAccessToken(new AccessToken("fake", new Date(100))).build();
4646
private static final StackdriverStatsConfiguration CONFIGURATION =
@@ -64,7 +64,7 @@ public void createWithNegativeDuration_WithConfiguration() throws IOException {
6464
StackdriverStatsConfiguration.builder()
6565
.setCredentials(FAKE_CREDENTIALS)
6666
.setProjectId(PROJECT_ID)
67-
.setExportInterval(NEG_ONE_SECOND)
67+
.setExportInterval(NEG_ONE_MINUTE)
6868
.build();
6969
thrown.expect(IllegalArgumentException.class);
7070
thrown.expectMessage("Export interval must be positive");
@@ -77,7 +77,7 @@ public void createWithNullCredentials() throws IOException {
7777
thrown.expect(NullPointerException.class);
7878
thrown.expectMessage("credentials");
7979
StackdriverStatsExporter.createAndRegisterWithCredentialsAndProjectId(
80-
null, PROJECT_ID, ONE_SECOND);
80+
null, PROJECT_ID, ONE_MINUTE);
8181
}
8282

8383
@Test
@@ -86,7 +86,7 @@ public void createWithNullProjectId() throws IOException {
8686
thrown.expect(NullPointerException.class);
8787
thrown.expectMessage("projectId");
8888
StackdriverStatsExporter.createAndRegisterWithCredentialsAndProjectId(
89-
GoogleCredentials.newBuilder().build(), null, ONE_SECOND);
89+
GoogleCredentials.newBuilder().build(), null, ONE_MINUTE);
9090
}
9191

9292
@Test
@@ -104,7 +104,7 @@ public void createWithNegativeDuration() throws IOException {
104104
thrown.expect(IllegalArgumentException.class);
105105
thrown.expectMessage("Export interval must be positive");
106106
StackdriverStatsExporter.createAndRegisterWithCredentialsAndProjectId(
107-
GoogleCredentials.newBuilder().build(), PROJECT_ID, NEG_ONE_SECOND);
107+
GoogleCredentials.newBuilder().build(), PROJECT_ID, NEG_ONE_MINUTE);
108108
}
109109

110110
@Test
@@ -137,7 +137,7 @@ public void unregister() throws IOException {
137137
public void createWithNullMonitoredResource() throws IOException {
138138
thrown.expect(NullPointerException.class);
139139
thrown.expectMessage("monitoredResource");
140-
StackdriverStatsExporter.createAndRegisterWithMonitoredResource(ONE_SECOND, null);
140+
StackdriverStatsExporter.createAndRegisterWithMonitoredResource(ONE_MINUTE, null);
141141
}
142142

143143
@Test

0 commit comments

Comments
 (0)