Class Meter.Builder

  • Enclosing interface:
    Meter

    public static class Meter.Builder
    extends Object
    Fluent builder for custom meters.
    • Method Detail

      • tags

        public Meter.Builder tags​(String... tags)
        Parameters:
        tags - Must be an even number of arguments representing key/value pairs of tags.
        Returns:
        The custom meter builder with added tags.
      • tags

        public Meter.Builder tags​(Iterable<Tag> tags)
        Parameters:
        tags - Tags to add to the eventual meter.
        Returns:
        The custom meter builder with added tags.
      • tag

        public Meter.Builder tag​(String key,
                                 String value)
        Parameters:
        key - The tag key.
        value - The tag value.
        Returns:
        The custom meter builder with a single added tag.
      • description

        public Meter.Builder description​(@Nullable
                                         String description)
        Parameters:
        description - Description text of the eventual meter.
        Returns:
        The custom meter builder with added description.
      • baseUnit

        public Meter.Builder baseUnit​(@Nullable
                                      String unit)
        Parameters:
        unit - Base unit of the eventual meter.
        Returns:
        The custom meter builder with added base unit.
      • hierarchicalName

        public Meter.Builder hierarchicalName​(String hierarchicalName)
        Parameters:
        hierarchicalName - the hierarchical representation of the meter name
        Returns:
        The custom meter builder with added hierarchical name.
      • register

        public Meter register​(MeterRegistry registry)
        Add the meter to a single registry, or return an existing meter in that registry. The returned meter will be unique for each registry, but each registry is guaranteed to only create one meter for the same combination of name and tags.
        Parameters:
        registry - A registry to add the custom meter to, if it doesn't already exist.
        Returns:
        A new or existing custom meter.