Sha256: 9d8ff2c1daa7475b4d91d60cf88f8a301ffba6b43ab0337b095d42d095474651

Contents?: true

Size: 1.03 KB

Versions: 20

Compression:

Stored size: 1.03 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 => error
        @config.log_found_exception(__method__.to_s, error)
      end

      def record_exception(method)
        @adapter.hincrby(exception_key, "#{@sdk_version}/#{@name}/#{@ip}/#{method}", 1)
      rescue StandardError => error
        @config.log_found_exception(__method__.to_s, error)
      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

20 entries across 20 versions & 1 rubygems

Version Path
splitclient-rb-7.3.2.pre.rc4-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.2.pre.rc4 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.2.pre.rc3-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.2.pre.rc3 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.2.pre.rc2-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.2.pre.rc2 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.2.pre.rc1-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.2.pre.rc1 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.1-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.1 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.1.pre.rc1-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.1.pre.rc1 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.0-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.0 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.0.pre.rc3-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.0.pre.rc3 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.0.pre.rc2-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.0.pre.rc2 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.0.pre.rc1-java lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb
splitclient-rb-7.3.0.pre.rc1 lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb