Class Search


  • public final class Search
    extends java.lang.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 Detail

      • name

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

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

        public Search tags​(java.lang.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​(java.lang.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​(java.lang.String tagKey,
                          java.lang.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​(java.lang.String... tagKeys)
        Meter contains tags with the matching keys.
        Parameters:
        tagKeys - The tag keys to match.
        Returns:
        This search.
      • timer

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

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

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

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

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

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

        public java.util.Collection<Timer> timers()
        Returns:
        All matching Timer meters.
      • timeGauges

        public java.util.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.