use duration parser in jmx metrics (#10532)
This commit is contained in:
parent
485b8f4218
commit
5d9efb1f20
|
@ -20,6 +20,7 @@ import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.time.Duration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/** An {@link AgentListener} that enables JMX metrics during agent startup. */
|
/** An {@link AgentListener} that enables JMX metrics during agent startup. */
|
||||||
|
@ -46,8 +47,9 @@ public class JmxMetricInsightInstaller implements AgentListener {
|
||||||
|
|
||||||
// If discovery delay has not been configured, have a peek at the metric export interval.
|
// If discovery delay has not been configured, have a peek at the metric export interval.
|
||||||
// It makes sense for both of these values to be similar.
|
// It makes sense for both of these values to be similar.
|
||||||
long exportInterval = configProperties.getLong("otel.metric.export.interval", 60000);
|
return configProperties
|
||||||
return exportInterval;
|
.getDuration("otel.metric.export.interval", Duration.ofMinutes(1))
|
||||||
|
.toMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String resourceFor(String platform) {
|
private static String resourceFor(String platform) {
|
||||||
|
|
Loading…
Reference in New Issue