Class Collector.MetricFamilySamples

    • Method Detail

      • filter

        public Collector.MetricFamilySamples filter​(Predicate<java.lang.String> sampleNameFilter)
        Parameters:
        sampleNameFilter - may be null indicating that the result contains the complete list of samples.
        Returns:
        A new MetricFamilySamples containing only the Samples matching the sampleNameFilter, or null if no Sample matches.
      • getNames

        public java.lang.String[] getNames()
        List of names that are reserved for Samples in these MetricsFamilySamples.

        This is used in two places:

        1. To check potential name collisions in CollectorRegistry.register(Collector).
        2. To check if a collector may contain metrics matching the metric name filter in Collector.collect(Predicate).
        Note that getNames() always includes the name without suffix, even though some metrics types (like Counter) will not have a Sample with that name. The reason is that the name without suffix is used in the metadata comments (# TYPE, # UNIT, # HELP), and as this name must be unique we include the name without suffix here as well.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object