Sha256: e4b75ecb9095dd3bc94553fba59643335062ffa635c61df26a8726d338b9892c

Contents?: true

Size: 1.02 KB

Versions: 60

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module SplitIoClient
  module Telemetry
    class RedisEvaluationProducer < EvaluationProducer
      def initialize(config)
        @config = config
        @adapter = config.telemetry_adapter

        @sdk_version = "#{@config.language}-#{@config.version}"
        @name = @config.machine_name
        @ip = @config.machine_ip
      end

      def record_latency(method, bucket)
        @adapter.hincrby(latency_key, "#{@sdk_version}/#{@name}/#{@ip}/#{method}/#{bucket}", 1)
      rescue StandardError => e
        @config.log_found_exception(__method__.to_s, e)
      end

      def record_exception(method)
        @adapter.hincrby(exception_key, "#{@sdk_version}/#{@name}/#{@ip}/#{method}", 1)
      rescue StandardError => e
        @config.log_found_exception(__method__.to_s, e)
      end

      private

      def latency_key
        "#{@config.redis_namespace}.telemetry.latencies"
      end

      def exception_key
        "#{@config.redis_namespace}.telemetry.exceptions"
      end
    end
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
splitclient-rb-8.0.0.pre.rc1-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-8.0.0.pre.rc1 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.5.pre.rc5-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.5.pre.rc5 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.5.pre.rc4-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.5.pre.rc4 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.5.pre.rc3-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.5.pre.rc3 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.5.pre.rc2-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.5.pre.rc2 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.5.pre.rc1-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.5.pre.rc1 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.4-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.4 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.4.pre.rc2-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.4.pre.rc2 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.4.pre.rc1-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.4.pre.rc1 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.3-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.3 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb