Class ViewBuilder


  • public final class ViewBuilder
    extends java.lang.Object
    A builder for View.
    Since:
    1.14.0
    • Field Detail

      • name

        @Nullable
        private java.lang.String name
      • description

        @Nullable
        private java.lang.String description
      • cardinalityLimit

        private int cardinalityLimit
    • Constructor Detail

      • ViewBuilder

        ViewBuilder()
    • Method Detail

      • setName

        public ViewBuilder setName​(java.lang.String name)
        Sets the name of the resulting metric.
        Parameters:
        name - metric name or null if the matched instrument name should be used.
      • setDescription

        public ViewBuilder setDescription​(java.lang.String description)
        Sets the description of the resulting metric.
        Parameters:
        description - metric description or null if the matched instrument description should be used.
      • setAttributeFilter

        public ViewBuilder setAttributeFilter​(java.util.Set<java.lang.String> keysToRetain)
        Sets a filter which retains attribute keys included in keysToRetain.
        Since:
        1.30.0
      • setAttributeFilter

        public ViewBuilder setAttributeFilter​(java.util.function.Predicate<java.lang.String> keyFilter)
        Sets a filter for attributes keys.

        Only attribute keys that pass the supplied Predicate will be included in the output.

        Parameters:
        keyFilter - filter for attribute keys to include.
      • setCardinalityLimit

        public ViewBuilder setCardinalityLimit​(int cardinalityLimit)
        Set the cardinality limit.

        Read MemoryMode to understand the memory usage behavior of reaching cardinality limit.

        Parameters:
        cardinalityLimit - the maximum number of series for a metric
        Since:
        1.44.0
      • build

        public View build()
        Returns a View with the configuration of this builder.