Skip to content

Commit a6bb8e4

Browse files
authored
Support ISO8601 for KairosDbSink histogramTtl and ttl parameters. (#79)
1 parent 8430227 commit a6bb8e4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/main/java/com/arpnetworking/tsdcore/sinks/KairosDbSink.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import com.google.common.collect.Lists;
3838
import net.sf.oval.constraint.Min;
3939
import net.sf.oval.constraint.NotNull;
40+
import org.joda.time.Period;
4041
import org.joda.time.format.ISOPeriodFormat;
4142

4243
import java.io.ByteArrayOutputStream;
@@ -181,10 +182,10 @@ private void addChunk(
181182
private KairosDbSink(final Builder builder) {
182183
super(builder);
183184
_maxRequestSize = builder._maxRequestSize;
184-
_ttlSeconds = (int) builder._ttl.getSeconds();
185+
_ttlSeconds = builder._ttl.toStandardSeconds().getSeconds();
185186
_publishStandardMetrics = builder._publishStandardMetrics;
186187
_publishHistograms = builder._publishHistograms;
187-
_histogramTtlSeconds = (int) builder._histogramTtl.getSeconds();
188+
_histogramTtlSeconds = builder._histogramTtl.toStandardSeconds().getSeconds();
188189
}
189190

190191
private final int _maxRequestSize;
@@ -521,7 +522,7 @@ public Builder setPublishHistograms(final Boolean value) {
521522
* @param value the time to retain histograms
522523
* @return This instance of {@link Builder}.
523524
*/
524-
public Builder setTtl(final Duration value) {
525+
public Builder setTtl(final Period value) {
525526
_ttl = value;
526527
return this;
527528
}
@@ -534,7 +535,7 @@ public Builder setTtl(final Duration value) {
534535
* @param value the time to retain histograms
535536
* @return This instance of {@link Builder}.
536537
*/
537-
public Builder setHistogramTtl(final Duration value) {
538+
public Builder setHistogramTtl(final Period value) {
538539
_histogramTtl = value;
539540
return this;
540541
}
@@ -547,8 +548,8 @@ public Builder setHistogramTtl(final Duration value) {
547548
@NotNull
548549
private Boolean _publishHistograms = false;
549550
@NotNull
550-
private Duration _histogramTtl = Duration.ofSeconds(0);
551+
private Period _histogramTtl = Period.seconds(0);
551552
@NotNull
552-
private Duration _ttl = Duration.ofSeconds(0);
553+
private Period _ttl = Period.seconds(0);
553554
}
554555
}

0 commit comments

Comments
 (0)