Temporality configuration setup is not working for the OpenTelemetry Spring Boot starter

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

<span>otel</span>:<br>  <span>service</span>:<br>    <span>name</span>: my-service<br>  <span>logs</span>:<br>    <span>exporter</span>: none<br>  <span>propagators</span>: tracecontext<br>  <span>exporter</span>:<br>    <span>otlp</span>:<br>      <span>protocol</span>: http/protobuf<br>      <span>traces</span>:<br>        <span>endpoint</span>: https://base/api/v2/otlp/v1/traces<br>        <span>exporter</span>:<br>          <span>interval</span>: 60000<br>      <span>metrics</span>:<br>        <span>endpoint</span>: https://base/api/v2/otlp/v1/metrics<br>        <span>aggregation_temporality</span>:<br>          <span>counter</span>: delta      <span># or delta<br></span><span>        #          histogram: delta<br></span><span>        #          observable_gauge: cumulative<br></span>        <span>exporter</span>:<br>          <span>interval</span>: 60000<br>        <span>enabled</span>: true<br>      <span>headers</span>: Authorization=Api-Token token

2. Using env variable

<span class="">OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE</span>

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!

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: SDK configuration | OpenTelemetry

1 Like