Class SelectorConfig

java.lang.Object
io.opentelemetry.instrumentation.api.incubator.config.internal.SelectorConfig

public final class SelectorConfig extends Object
Resolves an included/excluded selector and its deprecated include-only predecessor, so that precedence and deprecation warnings are uniform across instrumentations.

The property names are derived from the instrumentation and selector names. For ("messaging", "headers"), experimental resolution reads the headers/development node and otel.instrumentation.messaging.experimental.headers.included|excluded. Stable resolution reads the headers node and otel.instrumentation.messaging.headers.included|excluded. Both modes fall back to the deprecated experimental capture_headers/development node and otel.instrumentation.messaging.experimental.capture-headers flat property.

Flat system properties are read directly only when systemPropertyFallback is true; otherwise the flat names describe the equivalent form of the supplied declarative configuration.

This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The stability of the included/excluded selector configuration.
  • Method Summary

    Modifier and Type
    Method
    Description
    static io.opentelemetry.instrumentation.api.config.IncludeExclude
    resolve(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName)
    Deprecated.
    Use resolve(DeclarativeConfigProperties, String, String, Stability) and specify the selector configuration stability explicitly.
    static io.opentelemetry.instrumentation.api.config.IncludeExclude
    resolve(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName, boolean systemPropertyFallback)
    Deprecated.
    Use resolve(DeclarativeConfigProperties, String, String, Stability, boolean) and specify the selector configuration stability explicitly.
    static io.opentelemetry.instrumentation.api.config.IncludeExclude
    resolve(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName, SelectorConfig.Stability stability)
    Returns the configured selector, or null when nothing is configured to be captured.
    static io.opentelemetry.instrumentation.api.config.IncludeExclude
    resolve(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName, SelectorConfig.Stability stability, boolean systemPropertyFallback)
    Returns the configured selector, or null when nothing is configured to be captured.
    static io.opentelemetry.instrumentation.api.config.IncludeExclude
    resolveDeprecatedCapture(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName, String replacementInstrumentationName, SelectorConfig.Stability replacementStability, boolean systemPropertyFallback)
    Resolves the deprecated include-only predecessor of a selector.
    resolveLegacyBoolean(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName)
    Returns a predicate matching the configured selector, or null when nothing is configured to be captured.
    resolveLegacyBoolean(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName, String deprecatedSelectorName)
    Returns a predicate matching the configured selector, or null when nothing is configured to be captured.
    resolveLegacyLiteral(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName)
    Returns a predicate matching the configured selector, or null when nothing is configured to be captured.
    resolveLegacyLiteral(List<String> deprecatedValues)
    Returns a predicate matching the given deprecated include-only values, or null when nothing is configured to be captured.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • resolve

      @Deprecated @Nullable public static io.opentelemetry.instrumentation.api.config.IncludeExclude resolve(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName)
      Deprecated.
      Use resolve(DeclarativeConfigProperties, String, String, Stability) and specify the selector configuration stability explicitly. May be removed in the next minor release.
      Returns the configured selector, or null when nothing is configured to be captured.

      Note that null is returned rather than an empty selector because an empty selector matches every value.

      Values of the deprecated include-only setting that contain * or ? are ignored and logged, since that setting matches values literally and never supported wildcards.

    • resolve

      @Deprecated @Nullable public static io.opentelemetry.instrumentation.api.config.IncludeExclude resolve(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName, boolean systemPropertyFallback)
      Deprecated.
      Use resolve(DeclarativeConfigProperties, String, String, Stability, boolean) and specify the selector configuration stability explicitly. May be removed in the next minor release.
      Returns the configured selector, or null when nothing is configured to be captured.

      Values of the deprecated include-only setting that contain * or ? are ignored and logged, since that setting matches values literally and never supported wildcards.

      Parameters:
      systemPropertyFallback - whether to fall back to the flat system properties when the declarative configuration does not contain a value. This is needed by library instrumentation entry points that have no programmatic configuration surface.
    • resolve

      @Nullable public static io.opentelemetry.instrumentation.api.config.IncludeExclude resolve(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName, SelectorConfig.Stability stability)
      Returns the configured selector, or null when nothing is configured to be captured.

      Values of the deprecated include-only setting that contain * or ? are ignored and logged, since that setting matches values literally and never supported wildcards.

      Parameters:
      stability - whether the included/excluded selector is stable or experimental
    • resolve

      @Nullable public static io.opentelemetry.instrumentation.api.config.IncludeExclude resolve(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName, SelectorConfig.Stability stability, boolean systemPropertyFallback)
      Returns the configured selector, or null when nothing is configured to be captured.

      Values of the deprecated include-only setting that contain * or ? are ignored and logged, since that setting matches values literally and never supported wildcards.

      Parameters:
      stability - whether the included/excluded selector is stable or experimental
      systemPropertyFallback - whether to fall back to the flat system properties when the declarative configuration does not contain a value. This is needed by library instrumentation entry points that have no programmatic configuration surface.
    • resolveDeprecatedCapture

      @Nullable public static io.opentelemetry.instrumentation.api.config.IncludeExclude resolveDeprecatedCapture(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName, String replacementInstrumentationName, SelectorConfig.Stability replacementStability, boolean systemPropertyFallback)
      Resolves the deprecated include-only predecessor of a selector.
      Parameters:
      instrumentationName - the instrumentation namespace of the deprecated setting
      replacementInstrumentationName - the instrumentation namespace of the replacement
      replacementStability - whether the replacement selector is stable or experimental
      systemPropertyFallback - whether to fall back to the flat system property when the declarative configuration does not contain a value
    • resolveLegacyLiteral

      @Nullable public static Predicate<String> resolveLegacyLiteral(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName)
      Returns a predicate matching the configured selector, or null when nothing is configured to be captured.

      Unlike resolve(DeclarativeConfigProperties, String, String), the values of the deprecated include-only setting are matched literally, except for the single value "*" which matches everything. This preserves the behavior of settings that documented "*" as capturing all values, where interpreting the remaining values as globs would silently widen what is captured.

    • resolveLegacyLiteral

      @Nullable public static Predicate<String> resolveLegacyLiteral(List<String> deprecatedValues)
      Returns a predicate matching the given deprecated include-only values, or null when nothing is configured to be captured.

      The values are matched literally, except for the single value "*" which matches everything. This preserves the behavior of settings that documented "*" as capturing all values, where interpreting the remaining values as globs would silently widen what is captured.

    • resolveLegacyBoolean

      @Nullable public static Predicate<String> resolveLegacyBoolean(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName)
      Returns a predicate matching the configured selector, or null when nothing is configured to be captured.

      Unlike resolve(DeclarativeConfigProperties, String, String), the deprecated setting is a boolean, where true selects every value and false selects none.

    • resolveLegacyBoolean

      @Nullable public static Predicate<String> resolveLegacyBoolean(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName, String deprecatedSelectorName)
      Returns a predicate matching the configured selector, or null when nothing is configured to be captured.

      Unlike resolveLegacyBoolean(DeclarativeConfigProperties, String, String), the deprecated boolean setting is named after deprecatedSelectorName instead of selectorName, for settings that were not renamed consistently with their replacement.