Module: Bones::RPC::Instrumentable

Included in:
Node
Defined in:
lib/bones/rpc/instrumentable.rb,
lib/bones/rpc/instrumentable/log.rb,
lib/bones/rpc/instrumentable/noop.rb

Defined Under Namespace

Classes: Log, Noop

Constant Summary collapse

TOPIC =

The name of the topic of operations for Bones::RPC.

Since:

  • 2.0.0

"bones-rpc.operations"
WARN =

Topic for warning instrumentation.

Since:

  • 2.0.0

"bones-rpc.warn"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#instrumenterObject

Returns the value of attribute instrumenter.



21
22
23
# File 'lib/bones/rpc/instrumentable.rb', line 21

def instrumenter
  @instrumenter
end

Instance Method Details

#instrument(name, payload = {}, &block) ⇒ Object

Instrument and execute the provided block.

Examples:

Instrument and execute.

instrument("bones-rpc.noop") do
  node.connect
end

Parameters:

  • name (String)

    The name of the operation.

  • payload (Hash) (defaults to: {})

    The payload.

Returns:

  • (Object)

    The result of the yield.

Since:

  • 2.0.0



36
37
38
# File 'lib/bones/rpc/instrumentable.rb', line 36

def instrument(name, payload = {}, &block)
  instrumenter.instrument(name, payload, &block)
end