Split OpenTelemetry auto-configuration

The OpenTelemetry bean is now configured in the
OpenTelemetryAutoConfiguration. This method also applies
SdkLoggerProvider and SdkMeterProvider.

Additionally, the OpenTelemetry Resource is now a bean. Resource
attributes can now be configured through properties

The resourceAttributes in OtlpProperties have been deprecated in favor
of the new one in OpenTelemetryProperties.

Closes gh-36544
Closes gh-36545
This commit is contained in:
Moritz Halbritter
2023-07-25 10:46:54 +02:00
parent 9cb5763794
commit b0615dd311
14 changed files with 417 additions and 76 deletions

View File

@@ -67,4 +67,15 @@ include::code:MyObservationPredicate[]
The preceding example will prevent all observations whose name contains "denied".
[[actuator.observability.opentelemetry]]
=== OpenTelemetry Support
Spring Boot's actuator module includes basic support for https://opentelemetry.io/[OpenTelemetry].
It provides a bean of type `OpenTelemetry`, and if there are beans of type `SdkTracerProvider`, `ContextPropagators`, `SdkLoggerProvider` or `SdkMeterProvider` in the application context, they automatically get registered.
Additionally, it provides a `Resource` bean.
The attributes of the `Resource` can be configured via the configprop:management.opentelemetry.resource-attributes[] configuration property.
NOTE: Spring Boot does not provide auto-configuration for OpenTelemetry metrics or logging.
OpenTelemetry tracing is only auto-configured when used together with <<actuator#actuator.micrometer-tracing, Micrometer Tracing>>.
The next sections will provide more details about logging, metrics and traces.