Class Meter.Id

  • Enclosing interface:
    Meter

    public static class Meter.Id
    extends Object
    A meter is uniquely identified by its combination of name and tags.
    • Method Detail

      • withTag

        public Meter.Id withTag​(Tag tag)
        Generate a new id with an additional tag. If the key of the provided tag already exists, this overwrites the tag value.
        Parameters:
        tag - The tag to add.
        Returns:
        A new id with the provided tag. The source id remains unchanged.
      • withTag

        public Meter.Id withTag​(Statistic statistic)
        Generate a new id with an additional tag with a tag key of "statistic". If the "statistic" tag already exists, this overwrites the tag value.
        Parameters:
        statistic - The statistic tag to add.
        Returns:
        A new id with the provided tag. The source id remains unchanged.
      • withBaseUnit

        public Meter.Id withBaseUnit​(@Nullable
                                     String newBaseUnit)
        Generate a new id with a different base unit.
        Parameters:
        newBaseUnit - The base unit of the new id.
        Returns:
        A new id with the provided base unit. The source id remains unchanged.
      • withTags

        public Meter.Id withTags​(Iterable<Tag> tags)
        Generate a new id with a different set of tags.
        Parameters:
        tags - The tags of the new id
        Returns:
        A new id with the provided set of tags. The source id remains unchanged.
      • getName

        public String getName()
        Returns:
        The name of this meter.
      • getHierarchicalName

        public String getHierarchicalName()
        Returns:
        The hierarchical name of this meter.
      • getTags

        public Iterable<Tag> getTags()
        Returns:
        A set of dimensions that allows you to break down the name.
      • getTag

        @Nullable
        public String getTag​(String key)
        Parameters:
        key - The tag key to attempt to match.
        Returns:
        A matching tag, or null if no tag with the provided key exists on this id.
      • getBaseUnit

        @Nullable
        public String getBaseUnit()
        Returns:
        The base unit of measurement for this meter.
      • getConventionName

        public String getConventionName​(NamingConvention namingConvention)
        Parameters:
        namingConvention - The naming convention used to normalize the id's name.
        Returns:
        A name that has been stylized to a particular monitoring system's expectations.
      • getConventionTags

        public List<Tag> getConventionTags​(NamingConvention namingConvention)
        Tags that are sorted by key and formatted
        Parameters:
        namingConvention - The naming convention used to normalize the id's name.
        Returns:
        A list of tags that have been stylized to a particular monitoring system's expectations.
      • getDescription

        @Nullable
        public String getDescription()
        Returns:
        A description of the meter's purpose. This description text is published to monitoring systems that support description text.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getType

        public Meter.Type getType()
        The type is used by different registry implementations to structure the exposition of metrics to different backends.
        Returns:
        The meter's type.