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") the declarative configuration is read from the headers/development node of the supplied configuration, falling back to the deprecated capture_headers/development node, and the corresponding flat properties are otel.instrumentation.messaging.experimental.headers.included, ...headers.excluded and otel.instrumentation.messaging.experimental.capture-headers.

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

  • 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)
    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, boolean systemPropertyFallback)
    Returns the configured selector, or null when nothing is configured to be captured.
    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 java.lang.Object

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

    • resolve

      @Nullable public static io.opentelemetry.instrumentation.api.config.IncludeExclude resolve(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName)
      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

      @Nullable public static io.opentelemetry.instrumentation.api.config.IncludeExclude resolve(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties config, String instrumentationName, String selectorName, 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:
      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.
    • 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(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties, java.lang.String, java.lang.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(io.opentelemetry.api.incubator.config.DeclarativeConfigProperties, java.lang.String, java.lang.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.