Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure periodic metric reader interval with otel.metric.export.interval #3840

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions sdk-extensions/autoconfigure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,17 +221,18 @@ These properties can be used to control the maximum size of recordings per span.
|--------------------------|--------------------------|-----------------------------------------------------------------------------------|
| otel.metrics.exemplar.filter | OTEL_METRICS_EXEMPLAR_FILTER | The filter for exemplar sampling. Can be `NONE`, `ALL` or `WITH_SAMPLED_TRACE`. Default is `WITH_SAMPLED_TRACE`.|

## Interval metric reader
## Periodic Metric Reader

| System property | Environment variable | Description |
|--------------------------|--------------------------|-----------------------------------------------------------------------------------|
| otel.imr.export.interval | OTEL_IMR_EXPORT_INTERVAL | The interval, in milliseconds, between pushes to the exporter. Default is `60000`.|
| otel.metric.export.interval | OTEL_METRIC_EXPORT_INTERVAL | The interval, in milliseconds, between the start of two export attempts. Default is `60000`.|
| otel.imr.export.interval | OTEL_IMR_EXPORT_INTERVAL | **DEPRECATED for removal in 1.10.0.** The interval, in milliseconds, between the start of two export attempts. Default is `60000`.|

## Customizing the OpenTelemetry SDK

Autoconfiguration exposes SPI [hooks](../autoconfigure-spi/src/main/java/io/opentelemetry/sdk/autoconfigure/spi) for customizing behavior programmatically as needed.
It's recommended to use the above configuration properties where possible, only implementing the SPI to add functionality not found in the
SDK by default.

[javadoc-image]: https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-sdk-extension-autoconfigure.svg
[javadoc-image]: https://www.javadoc.io/badge/io.opentelemetry/opentelemetry- sdk-extension-autoconfigure.svg
[javadoc-url]: https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-sdk-extension-autoconfigure
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ private static void configurePeriodicMetricReader(
SdkMeterProviderBuilder sdkMeterProviderBuilder,
MetricExporter exporter) {

Duration exportInterval = config.getDuration("otel.imr.export.interval");
Duration exportInterval = config.getDuration("otel.metric.export.interval");
if (exportInterval == null) {
exportInterval = config.getDuration("otel.imr.export.interval");
}
if (exportInterval == null) {
exportInterval = Duration.ofMinutes(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ void configuresGlobal() {
System.setProperty("otel.exporter.otlp.endpoint", "https://localhost:" + server.httpsPort());
System.setProperty(
"otel.exporter.otlp.certificate", certificate.certificateFile().getAbsolutePath());
System.setProperty("otel.imr.export.interval", "1s");
System.setProperty("otel.metric.export.interval", "1s");

GlobalOpenTelemetry.get().getTracer("test").spanBuilder("test").startSpan().end();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ void configuresGlobal() {
"otel.exporter.otlp.endpoint",
"https://" + canonicalHostName + ":" + server.httpsPort() + "/");
System.setProperty("otel.exporter.otlp.certificate", certificateExtension.filePath);
System.setProperty("otel.imr.export.interval", "1s");
System.setProperty("otel.metric.export.interval", "1s");

GlobalOpenTelemetry.get().getTracer("test").spanBuilder("test").startSpan().end();

Expand Down