Class DeprecatedCaptureNames

java.lang.Object
io.opentelemetry.instrumentation.api.internal.DeprecatedCaptureNames

public final class DeprecatedCaptureNames extends Object
Converts the values of a deprecated include-only capture setting into a selector.

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

  • Method Details

    • toSelector

      @Nullable public static IncludeExclude toSelector(@Nullable Collection<String> names, String source, @Nullable String replacement)
      Returns a selector matching names, ignoring every name that contains * or ?, or null when no name remains.

      The deprecated include-only settings match names literally, so a value containing a glob metacharacter only ever matched a name containing that character literally, which in practice matched nothing. Interpreting such a value as a glob pattern would silently widen what is captured, turning a value of "*" that captured nothing into one that captures everything, including names holding credentials. Such values are ignored and logged instead.

      Because no remaining name contains a metacharacter, IncludeExclude matches them literally, so the returned selector captures exactly what this setting captured for the names it keeps.

      null is returned rather than an empty selector because an empty selector matches every name.

      Parameters:
      source - what configured the names, named in the warning
      replacement - what selects names by glob pattern instead, or null when there is no replacement for source
    • toSelectorOrEmpty

      public static IncludeExclude toSelectorOrEmpty(@Nullable Collection<String> names, String source, @Nullable String replacement)
      Returns a selector matching names, ignoring every name that contains * or ?, or an empty selector when no name remains. See toSelector(java.util.Collection<java.lang.String>, java.lang.String, java.lang.String) for why such names are ignored.

      This is the variant for settings that always hold a selector rather than an optional one, so that a setting whose every value was ignored captures nothing.