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 83dd5be
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 50 deletions.
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;
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 83dd5be

Please sign in to comment.