Skip to content

Commit

Permalink
Add support for low memory metric temporality setting
Browse files Browse the repository at this point in the history
`otel.exporter.otlp.metrics.temporality.preference` and `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` now support `LOWMEMORY` or `LowMemory` settings.

For more information, see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md#additional-configuration.
  • Loading branch information
tylerbenson committed Jun 20, 2023
1 parent e5e3f91 commit 72e1d6f
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 51 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
Comparing source compatibility of against
No changes.
*** MODIFIED INTERFACE: PUBLIC ABSTRACT io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector lowMemory()
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,20 @@ public static void configureOtlpAggregationTemporality(
if (temporalityStr == null) {
return;
}
AggregationTemporality temporality;
try {
temporality = AggregationTemporality.valueOf(temporalityStr.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
throw new ConfigurationException(
"Unrecognized aggregation temporality: " + temporalityStr, e);
AggregationTemporalitySelector temporalitySelector;
switch (temporalityStr.toLowerCase(Locale.ROOT)) {
case "cumulative":
temporalitySelector = AggregationTemporalitySelector.alwaysCumulative();
break;
case "delta":
temporalitySelector = AggregationTemporalitySelector.deltaPreferred();
break;
case "lowmemory":
temporalitySelector = AggregationTemporalitySelector.lowMemory();
break;

Check warning on line 166 in exporters/otlp/all/src/main/java/io/opentelemetry/exporter/otlp/internal/OtlpConfigUtil.java

View check run for this annotation

Codecov / codecov/patch

exporters/otlp/all/src/main/java/io/opentelemetry/exporter/otlp/internal/OtlpConfigUtil.java#L165-L166

Added lines #L165 - L166 were not covered by tests
default:
throw new ConfigurationException("Unrecognized aggregation temporality: " + temporalityStr);
}
AggregationTemporalitySelector temporalitySelector =
temporality == AggregationTemporality.CUMULATIVE
? AggregationTemporalitySelector.alwaysCumulative()
: AggregationTemporalitySelector.deltaPreferred();
aggregationTemporalitySelectorConsumer.accept(temporalitySelector);
}

Expand Down
Loading

0 comments on commit 72e1d6f

Please sign in to comment.