Class IncludeExclude

java.lang.Object
io.opentelemetry.instrumentation.api.config.IncludeExclude

public final class IncludeExclude extends Object
An immutable selector that matches strings against included and excluded glob patterns.

Matching is case-sensitive. ? matches any single character and * matches any number of characters, including none. Excluded patterns take precedence over included patterns. When there are no included patterns, all values that are not excluded match. Callers are responsible for normalizing values and patterns when a domain requires case-insensitive matching.

An empty selector, one with no included and no excluded patterns, carries no configuration. A setting that uses one should behave as if no selector were configured and fall back to its own default.

  • Method Details

    • builder

      public static IncludeExcludeBuilder builder()
      Returns a new builder for an IncludeExclude.
    • getIncluded

      public List<String> getIncluded()
      Returns the included patterns.
    • getExcluded

      public List<String> getExcluded()
      Returns the excluded patterns.
    • isEmpty

      public boolean isEmpty()
      Returns whether this selector has no included and no excluded patterns.

      An empty selector carries no configuration, so a setting that uses one should fall back to its own default, as if no selector were configured.

    • matches

      public boolean matches(String value)
      Returns whether value matches this selector.

      Excluded patterns take precedence over included patterns: an excluded value never matches, even when an included pattern also matches it. When there are no included patterns, every value that is not excluded matches, so an empty selector matches every value. A caller that treats an empty selector as no configuration should check isEmpty() rather than call this method.

    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object