19 Jul 2025
05:16 PM
- last edited on
28 Jul 2025
10:37 AM
by
AgataWlodarczyk
Hi,
I've successfully integrated the OpenTelemetry Spring Boot Starter with my Java application, and everything is working smoothly.
Now, I'm exploring how to change the metrics' temporality to Delta. So far, I've attempted the following configuration steps:
1. Using application.yml
otel:
service:
name: my-service
logs:
exporter: none
propagators: tracecontext
exporter:
otlp:
protocol: http/protobuf
traces:
endpoint: https://base/api/v2/otlp/v1/traces
exporter:
interval: 60000
metrics:
endpoint: https://base/api/v2/otlp/v1/metrics
aggregation_temporality:
counter: delta # or delta
# histogram: delta
# observable_gauge: cumulative
exporter:
interval: 60000
enabled: true
headers: Authorization=Api-Token token
2. Using env variable
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
Unfortunately, none of the approaches I've tried so far have worked. Has anyone encountered a similar issue or found a working solution?
Any guidance would be greatly appreciated—thank you!
24 Jul 2025 04:01 PM - edited 24 Jul 2025 04:02 PM
The application.yaml from Spring Boot follows the same property names as for the application.properties one.
For the latter, the temporality can be specified as:
otel.exporter.otlp.metrics.temporality.preference=DELTA
So, if using the YAML variant, you can do:
otel:
service:
name: my-service
exporter:
otlp:
metrics:
temporality:
preference: DELTA
Also, to make the config smaller, if you are sending all telemetry types Dynatrace (traces, metrics and logs) you can shorten the config by using the top-level endpoint property. Like so:
otel:
service:
name: my-service
exporter:
otlp:
protocol: http/protobuf
endpoint: https://{environmentid}.live.dynatrace.com/api/v2/otlp
headers: Authorization=Api-Token token
metrics:
temporality:
preference: DELTA
For a full view of the SDK configuration, see: https://opentelemetry.io/docs/zero-code/java/spring-boot-starter/sdk-configuration/