Class: Sentry::Metrics::SetMetric

Inherits:
Metric
  • Object
show all
Defined in:
lib/sentry/metrics/set_metric.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ SetMetric

Returns a new instance of SetMetric.



11
12
13
# File 'lib/sentry/metrics/set_metric.rb', line 11

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9
10
11
# File 'lib/sentry/metrics/set_metric.rb', line 9

def value
  @value
end

Instance Method Details

#add(value) ⇒ Object



15
16
17
# File 'lib/sentry/metrics/set_metric.rb', line 15

def add(value)
  @value << value
end

#serializeObject



19
20
21
# File 'lib/sentry/metrics/set_metric.rb', line 19

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

#weightObject



23
24
25
# File 'lib/sentry/metrics/set_metric.rb', line 23

def weight
  value.size
end