Sha256: a2a4c2c5a978e6eded586e1abe3a33844d94442d2211a212ffd09f747af55c00

Contents?: true

Size: 819 Bytes

Versions: 28

Compression:

Stored size: 819 Bytes

Contents

module StatsD::Instrument::Backends

  # The capture backend is used to capture the metrics that are collected, so you can
  # run assertions on them.
  #
  # @!attribute collected_metrics [r]
  #   @return [Array<StatsD::Instrument::Metric>] The list of metrics that were collected.
  # @see StatsD::Instrument::Assertions
  class CaptureBackend < StatsD::Instrument::Backend
    attr_reader :collected_metrics

    def initialize
      reset
    end

    # Adds a metric to the ist of collected metrics.
    # @param metric [StatsD::Instrument::Metric]  The metric to collect.
    # @return [void]
    def collect_metric(metric)
      @collected_metrics << metric
    end

    # Resets the list of collected metrics to an empty list.
    # @return [void]
    def reset
      @collected_metrics = []
    end
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
qubole-statsd-instrument-2.1.6 lib/statsd/instrument/backends/capture_backend.rb
statsd-instrument-2.3.5 lib/statsd/instrument/backends/capture_backend.rb
statsd-instrument-2.3.4 lib/statsd/instrument/backends/capture_backend.rb
qubole-statsd-instrument-2.1.5 lib/statsd/instrument/backends/capture_backend.rb
statsd-instrument-2.3.2 lib/statsd/instrument/backends/capture_backend.rb
statsd-instrument-2.3.1 lib/statsd/instrument/backends/capture_backend.rb
qubole-statsd-instrument-2.1.4 lib/statsd/instrument/backends/capture_backend.rb
statsd-instrument-2.3.0 lib/statsd/instrument/backends/capture_backend.rb
statsd-instrument-2.3.0.beta6 lib/statsd/instrument/backends/capture_backend.rb
statsd-instrument-2.3.0.beta5 lib/statsd/instrument/backends/capture_backend.rb
statsd-instrument-2.3.0.beta4 lib/statsd/instrument/backends/capture_backend.rb
statsd-instrument-2.3.0.beta3 lib/statsd/instrument/backends/capture_backend.rb
statsd-instrument-2.3.0.beta2 lib/statsd/instrument/backends/capture_backend.rb
statsd-instrument-2.3.0.beta lib/statsd/instrument/backends/capture_backend.rb
statsd-instrument-2.2.1 lib/statsd/instrument/backends/capture_backend.rb
statsd-instrument-2.2.0 lib/statsd/instrument/backends/capture_backend.rb
statsd-instrument-2.1.4 lib/statsd/instrument/backends/capture_backend.rb
statsd-instrument-2.1.3 lib/statsd/instrument/backends/capture_backend.rb
statsd-instrument-2.1.2 lib/statsd/instrument/backends/capture_backend.rb
statsd-instrument-2.1.1 lib/statsd/instrument/backends/capture_backend.rb