Class Search

java.lang.Object
io.micrometer.core.instrument.search.Search

public final class Search extends Object
Search terms for locating a Meter or set of meters in a given registry based on any combination of their name, tags, and type.
  • Method Details

    • name

      public Search name(String exactName)
      Meter contains a tag with the exact name.
      Parameters:
      exactName - Name to match against.
      Returns:
      This search.
    • name

      public Search name(@Nullable Predicate<String> nameMatches)
      Meter contains a tag matching the name predicate.
      Parameters:
      nameMatches - Name matching predicate.
      Returns:
      This search.
    • tags

      public Search tags(Iterable<Tag> tags)
      Meter contains tags with the matching tag keys and values.
      Parameters:
      tags - The tags to match.
      Returns:
      This search.
    • tags

      public Search tags(String... tags)
      Meter contains tags with the matching tag keys and values.
      Parameters:
      tags - Must be an even number of arguments representing key/value pairs of tags.
      Returns:
      This search.
    • tag

      public Search tag(String tagKey, String tagValue)
      Meter contains a tag with the matching key and value.
      Parameters:
      tagKey - The tag key to match.
      tagValue - The tag value to match.
      Returns:
      This search.
    • tagKeys

      public Search tagKeys(String... tagKeys)
      Meter contains tags with the matching keys.
      Parameters:
      tagKeys - The tag keys to match.
      Returns:
      This search.
    • tagKeys

      public Search tagKeys(Collection<String> tagKeys)
      Meter contains tags with the matching keys.
      Parameters:
      tagKeys - The tag keys to match.
      Returns:
      This search.
      Since:
      1.7.0
    • tag

      public Search tag(String tagKey, Predicate<String> tagValueMatches)
      Meter contains a tag with the provided key and a value matching tagValueMatches.
      Parameters:
      tagKey - The tag key to match.
      tagValueMatches - The test on the tag value.
      Returns:
      This search.
      Since:
      1.6.0
    • timer

      @Nullable public Timer timer()
      Returns:
      The first matching Timer, or null if none match.
    • counter

      @Nullable public Counter counter()
      Returns:
      The first matching Counter, or null if none match.
    • gauge

      @Nullable public Gauge gauge()
      Returns:
      The first matching Gauge, or null if none match.
    • functionCounter

      @Nullable public FunctionCounter functionCounter()
      Returns:
      The first matching FunctionCounter, or null if none match.
    • timeGauge

      @Nullable public TimeGauge timeGauge()
      Returns:
      The first matching TimeGauge, or null if none match.
    • functionTimer

      @Nullable public FunctionTimer functionTimer()
      Returns:
      The first matching FunctionTimer, or null if none match.
    • summary

      @Nullable public DistributionSummary summary()
      Returns:
      The first matching DistributionSummary, or null if none match.
    • longTaskTimer

      @Nullable public LongTaskTimer longTaskTimer()
      Returns:
      The first matching LongTaskTimer, or null if none match.
    • meter

      @Nullable public Meter meter()
      Returns:
      The first matching Meter, or null if none match.
    • meters

      public Collection<Meter> meters()
      Returns:
      All matching meters, or an empty collection if none match.
    • acceptFilter

      public MeterFilter acceptFilter()
      Returns:
      An accept filter that accepts any meter that matches this search.
      Since:
      1.6.0
    • counters

      public Collection<Counter> counters()
      Returns:
      All matching Counter meters.
    • gauges

      public Collection<Gauge> gauges()
      Returns:
      All matching Gauge meters.
    • timers

      public Collection<Timer> timers()
      Returns:
      All matching Timer meters.
    • summaries

      public Collection<DistributionSummary> summaries()
      Returns:
      All matching DistributionSummary meters.
    • longTaskTimers

      public Collection<LongTaskTimer> longTaskTimers()
      Returns:
      All matching LongTaskTimer meters.
    • functionCounters

      public Collection<FunctionCounter> functionCounters()
      Returns:
      All matching FunctionCounter meters.
    • functionTimers

      public Collection<FunctionTimer> functionTimers()
      Returns:
      All matching FunctionTimer meters.
    • timeGauges

      public Collection<TimeGauge> timeGauges()
      Returns:
      All matching TimeGauge meters.
    • in

      public static Search in(MeterRegistry registry)
      Initiate a new search for meters inside a registry.
      Parameters:
      registry - The registry to locate meters in.
      Returns:
      A new search.