Module: PrometheusExporter::Ext::RSpec::Matchers

Included in:
MetricMatcher, SendMetricsMatcher
Defined in:
lib/prometheus_exporter/ext/rspec/matchers.rb

Instance Method Summary collapse

Instance Method Details

#a_counter_metric(name) ⇒ Object



26
27
28
# File 'lib/prometheus_exporter/ext/rspec/matchers.rb', line 26

def a_counter_metric(name)
  a_prometheus_metric(PrometheusExporter::Metric::Counter, name)
end

#a_gauge_metric(name) ⇒ Object



18
19
20
# File 'lib/prometheus_exporter/ext/rspec/matchers.rb', line 18

def a_gauge_metric(name)
  a_prometheus_metric(PrometheusExporter::Metric::Gauge, name)
end

#a_gauge_with_expire_metric(name) ⇒ Object



22
23
24
# File 'lib/prometheus_exporter/ext/rspec/matchers.rb', line 22

def a_gauge_with_expire_metric(name)
  a_prometheus_metric(PrometheusExporter::Ext::Metric::GaugeWithExpire, name)
end

#a_histogram_metric(name) ⇒ Object



30
31
32
# File 'lib/prometheus_exporter/ext/rspec/matchers.rb', line 30

def a_histogram_metric(name)
  a_prometheus_metric(PrometheusExporter::Metric::Histogram, name)
end

#a_prometheus_metric(klass, name) ⇒ Object



14
15
16
# File 'lib/prometheus_exporter/ext/rspec/matchers.rb', line 14

def a_prometheus_metric(klass, name)
  MetricMatcher.new(klass, name)
end

#a_summary_metric(name) ⇒ Object



34
35
36
# File 'lib/prometheus_exporter/ext/rspec/matchers.rb', line 34

def a_summary_metric(name)
  a_prometheus_metric(PrometheusExporter::Metric::Summary, name)
end

#send_metrics(*expected) ⇒ Object



9
10
11
12
# File 'lib/prometheus_exporter/ext/rspec/matchers.rb', line 9

def send_metrics(*expected)
  expected = nil if expected.empty?
  PrometheusExporter::Ext::RSpec::SendMetricsMatcher.new(expected)
end