Sha256: 4dcb63c34cd1365ffc56bf1a3ea76f82678e465d308cb5f8c60ae4211a013a73
Contents?: true
Size: 673 Bytes
Versions: 2
Compression:
Stored size: 673 Bytes
Contents
require "harness" %w(circuit_open circuit_close).each do |event_name| ::ActiveSupport::Notifications.subscribe(event_name) do |_name, _start, _finish, _id, payload| circuit_name = payload.fetch(:circuit, "UNKNOWN_CIRCUIT") ::Harness.increment "circuitbox.#{circuit_name}.#{event_name}" end end ::ActiveSupport::Notifications.subscribe("circuit_gauge") do |_name, _start, _finish, _id, payload| circuit_name = payload.fetch(:circuit, "UNKNOWN_CIRCUIT") gauge = payload.fetch(:gauge, "UNKNOWN_GAUGE") value = payload.fetch(:value, "UNKNOWN_VALUE") metrics_key = "circuitbox.circuit.#{circuit_name}.#{gauge}" ::Harness.gauge(metrics_key, value) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
harness-circuitbox-0.1.1 | lib/harness/circuitbox.rb |
harness-circuitbox-0.1.0 | lib/harness/circuitbox.rb |