Method: InstrumentAllTheThings::Testing::RSpecMatchers#timing_values

Defined in:
lib/instrument_all_the_things/testing/rspec_matchers.rb

#timing_values(timing_name, with_tags: nil) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/instrument_all_the_things/testing/rspec_matchers.rb', line 37

def timing_values(timing_name, with_tags: nil)
  stats = InstrumentAllTheThings.stat_reporter.emitted_values[:timing][timing_name]

  if with_tags && !stats.empty?
    stats = stats.select do |s|
      with_tags.all? { |t| s[:tags].include?(t) }
    end
  end

  stats&.map { |i| i[:args] }&.map(&:first) || []
end