Module: Tenax::Instrumentation

Defined in:
lib/tenax/instrumentation.rb

Overview

Pluggable observability. The Runner emits events at well-defined points in execution; the configured sink receives them.

Sinks must respond to:

sink.emit(event_name, payload_hash)

Where event_name is a Symbol (e.g., :run_succeeded) and payload_hash is a Hash with documented keys per event. See Tenax::Runner for the complete event taxonomy.

Examples:

custom sink

class StatsDSink
  def initialize(client)
    @client = client
  end

  def emit(event, payload)
    case event
    when :run_succeeded
      @client.timing("tenax.run.duration", payload[:duration_ms],
                     tags: ["profile:#{payload[:profile_name]}"])
    when :run_failed
      @client.increment("tenax.run.failed",
                        tags: ["profile:#{payload[:profile_name]}",
                               "reason:#{payload[:reason]}"])
    end
  end
end

Tenax.configure do |c|
  c.instrumentation = StatsDSink.new($statsd)
end

Defined Under Namespace

Classes: Null