Sha256: b006701b0f5ad86c402c9f78d26c59a1720f05a98f4c92ea7fd49298ec35ae4a
Contents?: true
Size: 990 Bytes
Versions: 1
Compression:
Stored size: 990 Bytes
Contents
# frozen_string_literal: true # Copyright 2020 OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 module OpenTelemetry module Instrumentation module Sidekiq module Middlewares module Client class TracerMiddleware def call(_worker_class, job, _queue, _redis_pool) tracer.in_span( job['wrapped']&.to_s || job['class'], attributes: { 'messaging.message_id' => job['jid'], 'messaging.destination' => job['queue'], }, kind: :producer ) do |span| OpenTelemetry.propagation.text.inject(job) span.add_event(name: 'created_at', timestamp: job['created_at']) yield end end private def tracer Sidekiq::Instrumentation.instance.tracer end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
opentelemetry-instrumentation-sidekiq-0.5.0 | lib/opentelemetry/instrumentation/sidekiq/middlewares/client/tracer_middleware.rb |