Sha256: b9bb19dbbedd76dadfb989b77d644aaa14ea2598d6e6ca517a482a2b70166016

Contents?: true

Size: 589 Bytes

Versions: 13

Compression:

Stored size: 589 Bytes

Contents

module PrometheusExporter::Instrumentation
  class Sidekiq

    def initialize(client: nil)
      @client = client || PrometheusExporter::Client.default
    end

    def call(worker, msg, queue)
      success = false
      start = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
      result = yield
      success = true
      result
    ensure
      duration = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) - start

      @client.send_json(
        type: "sidekiq",
        name: worker.class.to_s,
        success: success,
        duration: duration
      )
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
prometheus_exporter-0.3.4 lib/prometheus_exporter/instrumentation/sidekiq.rb
prometheus_exporter-0.3.3 lib/prometheus_exporter/instrumentation/sidekiq.rb
prometheus_exporter-0.3.1 lib/prometheus_exporter/instrumentation/sidekiq.rb
prometheus_exporter-0.3.0 lib/prometheus_exporter/instrumentation/sidekiq.rb
prometheus_exporter-0.2.0 lib/prometheus_exporter/instrumentation/sidekiq.rb
prometheus_exporter-0.1.16 lib/prometheus_exporter/instrumentation/sidekiq.rb
prometheus_exporter-0.1.15 lib/prometheus_exporter/instrumentation/sidekiq.rb
prometheus_exporter-0.1.14 lib/prometheus_exporter/instrumentation/sidekiq.rb
prometheus_exporter-0.1.13 lib/prometheus_exporter/instrumentation/sidekiq.rb
prometheus_exporter-0.1.12 lib/prometheus_exporter/instrumentation/sidekiq.rb
prometheus_exporter-0.1.11 lib/prometheus_exporter/instrumentation/sidekiq.rb
prometheus_exporter-0.1.10 lib/prometheus_exporter/instrumentation/sidekiq.rb
prometheus_exporter-0.1.9 lib/prometheus_exporter/instrumentation/sidekiq.rb