Sha256: 4eac647fa53d3e5cf6e3f295868f52857d46179d636c7b576599a0d1208f328e

Contents?: true

Size: 432 Bytes

Versions: 16

Compression:

Stored size: 432 Bytes

Contents

# frozen_string_literal: true

require 'set'
require 'zlib'

module Sentry
  module Metrics
    class SetMetric < Metric
      attr_reader :value

      def initialize(value)
        @value = Set[value]
      end

      def add(value)
        @value << value
      end

      def serialize
        value.map { |x| x.is_a?(String) ? Zlib.crc32(x) : x.to_i }
      end

      def weight
        value.size
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
sentry-ruby-core-5.19.0 lib/sentry/metrics/set_metric.rb
sentry-ruby-5.19.0 lib/sentry/metrics/set_metric.rb
sentry-ruby-core-5.18.2 lib/sentry/metrics/set_metric.rb
sentry-ruby-5.18.2 lib/sentry/metrics/set_metric.rb
sentry-ruby-core-5.18.1 lib/sentry/metrics/set_metric.rb
sentry-ruby-5.18.1 lib/sentry/metrics/set_metric.rb
sentry-ruby-5.18.0 lib/sentry/metrics/set_metric.rb
sentry-ruby-core-5.18.0 lib/sentry/metrics/set_metric.rb
sentry-ruby-core-5.17.3 lib/sentry/metrics/set_metric.rb
sentry-ruby-5.17.3 lib/sentry/metrics/set_metric.rb
sentry-ruby-5.17.2 lib/sentry/metrics/set_metric.rb
sentry-ruby-core-5.17.2 lib/sentry/metrics/set_metric.rb
sentry-ruby-core-5.17.1 lib/sentry/metrics/set_metric.rb
sentry-ruby-5.17.1 lib/sentry/metrics/set_metric.rb
sentry-ruby-5.17.0 lib/sentry/metrics/set_metric.rb
sentry-ruby-core-5.17.0 lib/sentry/metrics/set_metric.rb