9
9
import io .opentelemetry .sdk .common .export .RetryPolicy ;
10
10
import io .opentelemetry .sdk .metrics .Aggregation ;
11
11
import io .opentelemetry .sdk .metrics .InstrumentType ;
12
+ import io .opentelemetry .sdk .metrics .data .AggregationTemporality ;
12
13
import io .opentelemetry .sdk .metrics .export .AggregationTemporalitySelector ;
13
14
import io .opentelemetry .sdk .metrics .export .DefaultAggregationSelector ;
14
15
import io .opentelemetry .sdk .metrics .export .MetricExporter ;
@@ -27,6 +28,7 @@ public class DynatraceMetricsExporterProvider implements ConfigurableMetricExpor
27
28
public static final String CRED_DYNATRACE_APIURL = "apiurl" ;
28
29
public static final String DT_APIURL_METRICS_SUFFIX = "/v2/otlp/v1/metrics" ;
29
30
private static final Logger LOG = Logger .getLogger (DynatraceMetricsExporterProvider .class .getName ());
31
+ private static final AggregationTemporalitySelector ALWAYS_DELTA = instrumentType -> AggregationTemporality .DELTA ;
30
32
private final Function <ConfigProperties , CfService > serviceProvider ;
31
33
32
34
public DynatraceMetricsExporterProvider () {
@@ -50,7 +52,7 @@ private static Duration getTimeOut(ConfigProperties config) {
50
52
private static AggregationTemporalitySelector getAggregationTemporalitySelector (ConfigProperties config ) {
51
53
String temporalityStr = config .getString ("otel.exporter.dynatrace.metrics.temporality.preference" );
52
54
if (temporalityStr == null ) {
53
- return AggregationTemporalitySelector . deltaPreferred () ;
55
+ return ALWAYS_DELTA ;
54
56
}
55
57
AggregationTemporalitySelector temporalitySelector ;
56
58
switch (temporalityStr .toLowerCase (Locale .ROOT )) {
@@ -60,6 +62,8 @@ private static AggregationTemporalitySelector getAggregationTemporalitySelector(
60
62
return AggregationTemporalitySelector .deltaPreferred ();
61
63
case "lowmemory" :
62
64
return AggregationTemporalitySelector .lowMemory ();
65
+ case "always_delta" :
66
+ return ALWAYS_DELTA ;
63
67
default :
64
68
throw new ConfigurationException ("Unrecognized aggregation temporality: " + temporalityStr );
65
69
}
0 commit comments