Class: RubyScriptExporter::Service::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_script_exporter/service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Builder

Returns a new instance of Builder.



27
28
29
# File 'lib/ruby_script_exporter/service.rb', line 27

def initialize(name)
  @service = Service.new(name)
end

Instance Attribute Details

#serviceObject (readonly)

Returns the value of attribute service.



25
26
27
# File 'lib/ruby_script_exporter/service.rb', line 25

def service
  @service
end

Instance Method Details

#label(key, value) ⇒ Object



31
32
33
# File 'lib/ruby_script_exporter/service.rb', line 31

def label(key, value)
  @service.labels[key] = value
end

#probe(name, &block) ⇒ Object



35
36
37
38
39
# File 'lib/ruby_script_exporter/service.rb', line 35

def probe(name, &block)
  probe_builder = Probe::Builder.new(name, @service)
  probe_builder.instance_eval(&block)
  @service.probes << probe_builder.probe
end