Sha256: 71c485122afe649afa45c5f6a6cb7a1b6302438b3c0546512c5f33595115c21e
Contents?: true
Size: 551 Bytes
Versions: 1
Compression:
Stored size: 551 Bytes
Contents
# frozen_string_literal: true require 'active_support/core_ext/benchmark' module Traxor module Sidekiq class Middleware DURATION_METRIC = 'sidekiq.worker.duration' COUNT_METRIC = 'sidekiq.worker.count' def call(worker, _job, queue) tags = Traxor::Tags.sidekiq = { sidekiq_worker: worker.class.name, sidekiq_queue: queue } Metric.count COUNT_METRIC, 1, tags time = Benchmark.ms { yield } Metric.measure DURATION_METRIC, "#{time.round(2)}ms", tags if time.positive? end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
traxor-0.1.20 | lib/traxor/sidekiq/middleware.rb |