Method: Libhoney::Client#add_dynamic_field

Defined in:
lib/libhoney/client.rb

#add_dynamic_field(name, proc) ⇒ self

adds a single field->dynamic value function to the global Builder.

Examples:

honey.add_dynamic_field("active_threads", Proc.new { Thread.list.select {|thread| thread.status == "run"}.count })

Parameters:

  • name (String)

    name of field to add.

  • proc (#call)

    function that will be called to generate the value whenever an event is created.

Returns:

  • (self)

    this libhoney instance.


149
150
151
152
# File 'lib/libhoney/client.rb', line 149

def add_dynamic_field(name, proc)
  @builder.add_dynamic_field(name, proc)
  self
end