类 OpenTelemetryResourceAttributes

java.lang.Object
org.springframework.boot.actuate.autoconfigure.opentelemetry.OpenTelemetryResourceAttributes

public final class OpenTelemetryResourceAttributes extends Object
OpenTelemetryResourceAttributes retrieves information from the OTEL_RESOURCE_ATTRIBUTES and OTEL_SERVICE_NAME environment variables and merges it with the resource attributes provided by the user. User-provided resource attributes take precedence. Additionally, spring.application.* related properties can be applied as defaults.

OpenTelemetry Resource Specification

从以下版本开始:
3.5.0
作者:
Dmytro Nosan
  • 构造器详细资料

    • OpenTelemetryResourceAttributes

      public OpenTelemetryResourceAttributes(Environment environment, Map<String,String> resourceAttributes)
      Creates a new instance of OpenTelemetryResourceAttributes.
      参数:
      environment - the environment
      resourceAttributes - user-provided resource attributes to be used
  • 方法详细资料

    • applyTo

      public void applyTo(BiConsumer<String,String> consumer)
      Applies resource attributes to the provided BiConsumer after being combined from environment variables and user-defined resource attributes.

      If a key exists in both environment variables and user-defined resources, the value from the user-defined resource takes precedence, even if it is empty.

      Additionally, spring.application.name or unknown_service will be used as the default for service.name, and spring.application.group will serve as the default for service.group and service.namespace.

      参数:
      consumer - the BiConsumer to apply