use duration parser in jmx metrics (#10532)

This commit is contained in:
Gregor Zeitlinger 2024-02-13 17:31:12 +01:00 committed by GitHub
parent 485b8f4218
commit 5d9efb1f20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -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) {