Stats Try it

If you are using something like DataDog or another StatsD provider, you can plug it in via the stats config.

In Java this can just be an instance of MetricRegistry

class RateLimit
  include Singleton
  attr_reader :limiter
  def initialize
    @limiter = RateLimit::Limiter.new(apikey: "ACCT_ID|APIKEY",
       stats: Metrics::MetricsReporter.instance
    )
  end
end


module Metrics
  class MetricsReporter
    include Singleton

    def initialize
      @statsd = Statsd.new("localhost", 8125)
    end

    attr_reader :statsd

    # I'll get called with
    # increment("it.ratelim.limitcheck", {:tags=>["policy_group:page_view", "pass:true"]})
    def increment(stat, opts = {})
      statsd.increment(stat, **opts)
    end
  end
end
@Provides
public ApiClient.Builder getapiClient(RedisClient redisClient, MetricRegistry metrics) throws IOException {
return new ApiClient.Builder()
    .setDistributedCache(new RedisWrapper(redisClient))
    .setFeatureFlagDistributedCacheExpirySecs(300)
    .setFeatureFlagRefetchBuffer(150)
    .setMetricRegistry(metrics);
}

Next read about Safety & Durability