Class MetricsCache

java.lang.Object
org.apache.hadoop.metrics2.util.MetricsCache

@Public @Evolving public class MetricsCache extends Object
A metrics cache for sinks that don't support sparse updates.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    org.apache.hadoop.metrics2.util.MetricsCache.Record
    Cached record
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    MetricsCache(int maxRecsPerName)
    Construct a metrics cache
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.hadoop.metrics2.util.MetricsCache.Record
    Get the cached record
    org.apache.hadoop.metrics2.util.MetricsCache.Record
    Update the cache and return the current cache record
    org.apache.hadoop.metrics2.util.MetricsCache.Record
    update(MetricsRecord mr, boolean includingTags)
    Update the cache and return the current cached record

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MetricsCache

      public MetricsCache()
    • MetricsCache

      public MetricsCache(int maxRecsPerName)
      Construct a metrics cache
      Parameters:
      maxRecsPerName - limit of the number records per record name
  • Method Details

    • update

      public org.apache.hadoop.metrics2.util.MetricsCache.Record update(MetricsRecord mr, boolean includingTags)
      Update the cache and return the current cached record
      Parameters:
      mr - the update record
      includingTags - cache tag values (for later lookup by name) if true
      Returns:
      the updated cache record
    • update

      public org.apache.hadoop.metrics2.util.MetricsCache.Record update(MetricsRecord mr)
      Update the cache and return the current cache record
      Parameters:
      mr - the update record
      Returns:
      the updated cache record
    • get

      public org.apache.hadoop.metrics2.util.MetricsCache.Record get(String name, Collection<MetricsTag> tags)
      Get the cached record
      Parameters:
      name - of the record
      tags - of the record
      Returns:
      the cached record or null