Sha256: e67f21d76dadac0d9ab7a623013895147d2709e56b546146cd106bd864eea0a6
Contents?: true
Size: 594 Bytes
Versions: 1
Compression:
Stored size: 594 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::Line.record do |l| l.count COUNT_METRIC, 1, tags time = Benchmark.ms { yield } l.measure DURATION_METRIC, "#{time.round(2)}ms", tags if time.positive? end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
traxor-0.2.0 | lib/traxor/sidekiq/middleware.rb |