Class StatsRegistry

  • All Implemented Interfaces:

    
    public final class StatsRegistry<T extends Meter>
    
                        

    Facilitates standard Micrometer Meter usage when we need to use them with parameters. For example, there might be common 'processingTime' timer and we want to use it for action=action1, action=action2, etc.

    Also it has a feature that context data for the target tag names is automatically retrieved from ExecutionContextManager and attached to data points generated by this registry's meters.

    Note: we introduce multiple overloaded getMeter methods here (getMeter(tag), getMeter(tag1, tag2), etc) instead of providing generic varargs-based processing because stats collection is expected to be performed quite often. Hence, we want to avoid new array construction every time getMeter is called.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      StatsRegistry(List<String> tagNames, Set<Tag> staticTags, MeterRegistry registry, ExecutionContextManager executionContextManager, Set<String> contextTagNames, Function2<MeterRegistry, Iterable<Tag>, T> meterCreator)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

      • StatsRegistry

        StatsRegistry(List<String> tagNames, Set<Tag> staticTags, MeterRegistry registry, ExecutionContextManager executionContextManager, Set<String> contextTagNames, Function2<MeterRegistry, Iterable<Tag>, T> meterCreator)
        Parameters:
        tagNames - list of the tag names to use for the target meter.
        staticTags - tags to be applied to every data point collected by this registry's meter
        registry - meter registry to use
        executionContextManager - context values holder
        contextTagNames - context tag names, their values are picked from ExecutionContextManager.getFromCurrentContext and are attached to data points produced by this registry's meters
        meterCreator - meter's initializer