Class Meter.Builder

  • Enclosing interface:
    Meter

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

      • tags

        public Meter.Builder tags​(java.lang.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​(java.lang.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​(java.lang.String key,
                                 java.lang.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
                                         java.lang.String description)
        Parameters:
        description - Description text of the eventual meter.
        Returns:
        The custom meter builder with added description.
      • baseUnit

        public Meter.Builder baseUnit​(@Nullable
                                      java.lang.String unit)
        Parameters:
        unit - Base unit of the eventual meter.
        Returns:
        The custom meter builder with added base unit.
      • 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.