类 RedisMetricRepository

    • 构造器概要

      构造器 
      构造器说明
      RedisMetricRepository​(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory)
      Create a RedisMetricRepository with a default prefix to apply to all metric names.
      RedisMetricRepository​(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory, String prefix)
      Create a RedisMetricRepository with a prefix to apply to all metric names (ideally unique to this repository or to a logical repository contributed to by multiple instances, where they all see the same values).
      RedisMetricRepository​(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory, String prefix, String key)
      Allows user to set the prefix and key to use to store the index of other keys.
    • 构造器详细资料

      • RedisMetricRepository

        public RedisMetricRepository​(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory)
        Create a RedisMetricRepository with a default prefix to apply to all metric names. If multiple repositories share a redis instance they will feed into the same global metrics.
        参数:
        redisConnectionFactory - the redis connection factory
      • RedisMetricRepository

        public RedisMetricRepository​(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory,
                                     String prefix)
        Create a RedisMetricRepository with a prefix to apply to all metric names (ideally unique to this repository or to a logical repository contributed to by multiple instances, where they all see the same values). Recommended constructor for general purpose use.
        参数:
        redisConnectionFactory - the redis connection factory
        prefix - the prefix to set for all metrics keys
      • RedisMetricRepository

        public RedisMetricRepository​(org.springframework.data.redis.connection.RedisConnectionFactory redisConnectionFactory,
                                     String prefix,
                                     String key)
        Allows user to set the prefix and key to use to store the index of other keys. The redis store will hold a zset under the key just so the metric names can be enumerated. Read operations, especially findAll() and count(), will only be accurate if the key is unique to the prefix of this repository.
        参数:
        redisConnectionFactory - the redis connection factory
        prefix - the prefix to set for all metrics keys
        key - the key to set
    • 方法详细资料

      • findOne

        public Metric<?> findOne​(String metricName)
        从接口复制的说明: MetricReader
        Find an instance of the metric with the given name (usually the latest recorded value).
        指定者:
        findOne 在接口中 MetricReader
        参数:
        metricName - the name of the metric to find
        返回:
        a metric value or null if there are none with that name
      • count

        public long count()
        从接口复制的说明: MetricReader
        The number of metrics known to this reader.
        指定者:
        count 在接口中 MetricReader
        返回:
        the number of metrics
      • increment

        public void increment​(Delta<?> delta)
        从接口复制的说明: CounterWriter
        Increment the value of a metric (or decrement if the delta is negative). The name of the delta is the name of the metric to increment.
        指定者:
        increment 在接口中 CounterWriter
        参数:
        delta - the amount to increment by
      • reset

        public void reset​(String metricName)
        从接口复制的说明: CounterWriter
        Reset the value of a metric, usually to zero value. Implementations can discard the old values if desired, but may choose not to. This operation is optional (some implementations may not be able to fulfill the contract, in which case they should simply do nothing).
        指定者:
        reset 在接口中 CounterWriter
        参数:
        metricName - the name to reset