File: distribution_metric.rb

package info (click to toggle)
ruby-sentry-ruby-core 5.28.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 672 kB
  • sloc: ruby: 6,118; makefile: 8; sh: 4
file content (25 lines) | stat: -rw-r--r-- 365 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

module Sentry
  module Metrics
    class DistributionMetric < Metric
      attr_reader :value

      def initialize(value)
        @value = [value.to_f]
      end

      def add(value)
        @value << value.to_f
      end

      def serialize
        value
      end

      def weight
        value.size
      end
    end
  end
end