To make the export work at all for a native image build, it needs to be enabled during AOT processing. So we have this for the profile used for the build:
management.otlp.tracing.export.enabled: true
Now we have a native image that has the OTLP export enabled and all could be fine.
But for tests we may want to disable this if no service to export to is available.
Running the native image with management.otlp.tracing.export.enabled=false
does not work so we end up with errors in the log because the export cannot connect to its target:
2025-07-30 11:46:57.877 ERROR 1 --- [.local:4318/...] i.o.exporter.internal.http.HttpExporter : Failed to export spans. The request could not be executed.
For non-native (or non-AOT) builds, runtime evaluation works as expected.
Are we missing anything or is this simply not supported? Does it make sense to create an issue to request that to be improved?
This is with Spring 3.5.4 but it didn't look like anything changed in this area.
We have a workaround using a config that provides a SpanExporters
bean similar to what OpenTelemetryTracingAutoConfiguration
would do if the export is enabled but return it empty if it is disabled.