99import io .opentelemetry .sdk .common .export .RetryPolicy ;
1010import io .opentelemetry .sdk .metrics .Aggregation ;
1111import io .opentelemetry .sdk .metrics .InstrumentType ;
12+ import io .opentelemetry .sdk .metrics .data .AggregationTemporality ;
1213import io .opentelemetry .sdk .metrics .export .AggregationTemporalitySelector ;
1314import io .opentelemetry .sdk .metrics .export .DefaultAggregationSelector ;
1415import io .opentelemetry .sdk .metrics .export .MetricExporter ;
@@ -27,6 +28,7 @@ public class DynatraceMetricsExporterProvider implements ConfigurableMetricExpor
2728 public static final String CRED_DYNATRACE_APIURL = "apiurl" ;
2829 public static final String DT_APIURL_METRICS_SUFFIX = "/v2/otlp/v1/metrics" ;
2930 private static final Logger LOG = Logger .getLogger (DynatraceMetricsExporterProvider .class .getName ());
31+ private static final AggregationTemporalitySelector ALWAYS_DELTA = instrumentType -> AggregationTemporality .DELTA ;
3032 private final Function <ConfigProperties , CfService > serviceProvider ;
3133
3234 public DynatraceMetricsExporterProvider () {
@@ -50,7 +52,7 @@ private static Duration getTimeOut(ConfigProperties config) {
5052 private static AggregationTemporalitySelector getAggregationTemporalitySelector (ConfigProperties config ) {
5153 String temporalityStr = config .getString ("otel.exporter.dynatrace.metrics.temporality.preference" );
5254 if (temporalityStr == null ) {
53- return AggregationTemporalitySelector . deltaPreferred () ;
55+ return ALWAYS_DELTA ;
5456 }
5557 AggregationTemporalitySelector temporalitySelector ;
5658 switch (temporalityStr .toLowerCase (Locale .ROOT )) {
@@ -60,6 +62,8 @@ private static AggregationTemporalitySelector getAggregationTemporalitySelector(
6062 return AggregationTemporalitySelector .deltaPreferred ();
6163 case "lowmemory" :
6264 return AggregationTemporalitySelector .lowMemory ();
65+ case "always_delta" :
66+ return ALWAYS_DELTA ;
6367 default :
6468 throw new ConfigurationException ("Unrecognized aggregation temporality: " + temporalityStr );
6569 }
0 commit comments