Class: Protor

Inherits:
Object
  • Object
show all
Includes:
MonitorMixin
Defined in:
lib/protor.rb,
lib/protor/entry.rb,
lib/protor/version.rb,
lib/protor/registry.rb,
lib/protor/udp_client.rb,
lib/protor/entry_family.rb,
lib/protor/logger_client.rb,
lib/protor/udp_formatter.rb

Defined Under Namespace

Classes: Entry, EntryFamily, IncompatibleTypeError, InvalidAdditionalError, InvalidLabelNameError, InvalidLabelValueError, InvalidNameError, InvalidTypeError, LoggerClient, Registry, UDPClient, UDPFormatter

Constant Summary collapse

DEFAULT_CONFIG =
{
  client: :udp,
  formatter: :udp,
  host: 'localhost',
  port: 10601,
  packet_size: 56_607
}
VERSION =
'0.1.2'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|config| ... } ⇒ Protor

Returns a new instance of Protor.

Yields:



22
23
24
25
26
27
28
# File 'lib/protor.rb', line 22

def initialize(&block)
  super(&block)

  @config = DEFAULT_CONFIG.dup
  @registry = Registry.new
  yield(config) if block_given?
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



20
21
22
# File 'lib/protor.rb', line 20

def config
  @config
end

#registryObject (readonly)

Returns the value of attribute registry.



20
21
22
# File 'lib/protor.rb', line 20

def registry
  @registry
end

Instance Method Details

#publishObject



30
31
32
33
34
35
36
# File 'lib/protor.rb', line 30

def publish
  safely do
    client.publish(registry)
    registry.reset
  end
  logger.debug("publish") if logger
end