Interface ReporterMetadata


  • public interface ReporterMetadata
    Access Cinnamon metric metadata in Coda Hale Metrics objects.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T> MetadataCache<T> createCache​(java.util.function.BiFunction<java.lang.String,​com.codahale.metrics.Metric,​T> createMetadata)
      Create the typed metadata cache.
      Descriptor getDescriptor​(com.codahale.metrics.Metric metric)
      Returns the descriptor for this metric or null if not available.
      java.lang.String getSimpleName​(com.codahale.metrics.Metric metric, java.lang.String defaultName)
      Get metric simple name, without full hierarchy.
      java.util.Map<java.lang.String,​java.lang.String> getTags​(com.codahale.metrics.Metric metric, boolean includeUnique)
      Get metric tags, using attached metadata.
      java.lang.String getUniqueName​(com.codahale.metrics.Metric metric, java.lang.String defaultName)
      Get full metric name, including unique dimensions.
      boolean isAttachedTo​(com.codahale.metrics.Metric metric)
      Whether a metric has attached metadata.
    • Method Detail

      • isAttachedTo

        boolean isAttachedTo​(com.codahale.metrics.Metric metric)
        Whether a metric has attached metadata.
        Parameters:
        metric - metric object that may have attached metadata
        Returns:
        whether metadata is attached to the given metric object
      • getSimpleName

        java.lang.String getSimpleName​(com.codahale.metrics.Metric metric,
                                       java.lang.String defaultName)
        Get metric simple name, without full hierarchy.
        Parameters:
        metric - metric object
        defaultName - default name if metadata is not attached
        Returns:
        simple name for metric object, using attached metadata
      • getUniqueName

        java.lang.String getUniqueName​(com.codahale.metrics.Metric metric,
                                       java.lang.String defaultName)
        Get full metric name, including unique dimensions.
        Parameters:
        metric - metric object
        defaultName - default name if metadata is not attached
        Returns:
        unique name for metric object, using attached metadata
      • getTags

        java.util.Map<java.lang.String,​java.lang.String> getTags​(com.codahale.metrics.Metric metric,
                                                                       boolean includeUnique)
        Get metric tags, using attached metadata.
        Parameters:
        metric - metric object
        includeUnique - whether to include unique identities as tags
        Returns:
        tags for metric object, using attached metadata
      • createCache

        <T> MetadataCache<T> createCache​(java.util.function.BiFunction<java.lang.String,​com.codahale.metrics.Metric,​T> createMetadata)
        Create the typed metadata cache. Note: each reporter can have only one metadata cache. Takes function to create metadata from metric name and object, if it's not already cached.
        Type Parameters:
        T - type of metadata
        Parameters:
        createMetadata - function to create metadata for a metric object
        Returns:
        new metadata cache specifically for this reporter
      • getDescriptor

        Descriptor getDescriptor​(com.codahale.metrics.Metric metric)
        Returns the descriptor for this metric or null if not available.
        Parameters:
        metric - metric object
        Returns:
        descriptor representing the metric object or null if not available