Sha256: 9252c10258e78b5a0a3cd16d711e95ad027738e965573338dae9a027206e9dae

Contents?: true

Size: 765 Bytes

Versions: 21

Compression:

Stored size: 765 Bytes

Contents

# frozen_string_literal: true

module PrometheusExporter::Instrumentation
  class Shoryuken

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

    def call(worker, queue, msg, body)
      success = false
      start = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
      result = yield
      success = true
      result
    rescue ::Shoryuken::Shutdown => e
      shutdown = true
      raise e
    ensure
      duration = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) - start
      @client.send_json(
          type: "shoryuken",
          queue: queue,
          name: worker.class.name,
          success: success,
          shutdown: shutdown,
          duration: duration
      )
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
prometheus_exporter-2.1.1 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-2.1.0 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-2.0.8 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-2.0.7 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-2.0.6 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-2.0.5 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-2.0.4 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-2.0.3 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-2.0.2 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-2.0.1 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-2.0.0 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-1.0.1 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-1.0.0 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-0.8.1 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-0.8.0 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-0.7.0 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-0.6.0 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-0.5.3 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-0.5.2 lib/prometheus_exporter/instrumentation/shoryuken.rb
prometheus_exporter-0.5.1 lib/prometheus_exporter/instrumentation/shoryuken.rb