spring-projects / spring-boot

Spring Boot
https://spring.io/projects/spring-boot
Apache License 2.0
74.96k stars 40.65k forks source link

Add property to control export of OTLP logs #42781

Open andrzej-fisglobal opened 3 days ago

andrzej-fisglobal commented 3 days ago

In Spring Boot 3.4.0-M3, OtlpLoggingConfigurations.otlpHttpLogRecordExporter is a created if OtlpLoggingConnectionDetails is created, the latter is a conditionally created if the property management.otlp.logging.endpoint is defined. It looks like the only option to disable this to not define the endpoint key.

However, it makes it a bit difficult if we have already defined the endpoint and want to disable it.

Is it possible to define an enabled toggle in a similar manner that we have for e.g. management.otlp.metrics.export? In general, it would be nice to be able to disable signal exporters in a consistent way -- thus something similar to OnEnabledTracingCondition and OnMetricsExportEnabledCondition?

mhalbritter commented 13 hours ago

We have management.*.metrics.export.enabled, management.*.tracing.export.enabled and I think for consistency we should also add something like management.otlp.logging.export.enabled.

nosan commented 8 hours ago

You should be able to disable the otlpHttpLogRecordExporter by setting management.otlp.logging.transport=none

nosan commented 8 hours ago

But this property does not exist in additional-spring-configuration-metadata.json 🥲

nosan commented 7 hours ago

Apologies @mhalbritter and @andrzej-fisglobal for the confusion. I overlooked the fact that this property maps to enum values. My apologies for the oversight.

mhalbritter commented 7 hours ago

Don't worry, no harm done :)