Sha256: bc4133a1af96d8c53e49636f5ca3dc23e16d539009e5b4274eb6e979bec73f74
Contents?: true
Size: 1.45 KB
Versions: 39
Compression:
Stored size: 1.45 KB
Contents
module Instana module Instrumentation class SidekiqClient def call(worker_class, msg, queue, _redis_pool) kv_payload = { :'sidekiq-client' => {} } kv_payload[:'sidekiq-client'][:queue] = queue kv_payload[:'sidekiq-client'][:job] = worker_class kv_payload[:'sidekiq-client'][:retry] = msg['retry'].to_s ::Instana.tracer.log_entry(:'sidekiq-client', kv_payload) # Temporary until we move connection collection to redis # instrumentation Sidekiq.redis_pool.with do |client| opts = client.respond_to?(:connection) ? client.connection : client.client.options kv_payload[:'sidekiq-client'][:'redis-url'] = "#{opts[:host]}:#{opts[:port]}" end context = ::Instana.tracer.context if context msg['X-Instana-T'] = context.trace_id_header msg['X-Instana-S'] = context.span_id_header end result = yield kv_payload[:'sidekiq-client'][:job_id] = result['jid'] result rescue => e ::Instana.tracer.log_error(e) raise ensure ::Instana.tracer.log_exit(:'sidekiq-client', kv_payload) end end end end if defined?(::Sidekiq) && ::Instana.config[:'sidekiq-client'][:enabled] ::Sidekiq.configure_client do |cfg| cfg.client_middleware do |chain| ::Instana.logger.debug "Instrumenting Sidekiq client" chain.add ::Instana::Instrumentation::SidekiqClient end end end
Version data entries
39 entries across 39 versions & 1 rubygems