Class: RubyScriptExporter::Runner

Inherits:
Object
  • Object
show all
Includes:
Observers::Http
Defined in:
lib/ruby_script_exporter/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Observers::Http

#observe_http

Constructor Details

#initialize(probe) ⇒ Runner

Returns a new instance of Runner.



8
9
10
11
# File 'lib/ruby_script_exporter/runner.rb', line 8

def initialize(probe)
  @probe = probe
  @measurements = []
end

Instance Attribute Details

#measurementsObject (readonly)

Returns the value of attribute measurements.



6
7
8
# File 'lib/ruby_script_exporter/runner.rb', line 6

def measurements
  @measurements
end

Instance Method Details

#observe(measurement, value, **labels) ⇒ Object



13
14
15
16
# File 'lib/ruby_script_exporter/runner.rb', line 13

def observe(measurement, value, **labels)
  timestamp = Time.now.to_i * 1000
  @measurements << Measurement.new(measurement, value, timestamp:, probe: @probe, **labels)
end