Sha256: 4bfc31615c7cc2129d08b858a6aa361ba7cb499ddbeedc8dc3481f481675ad9b
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true # Copyright 2020 OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 module OpenTelemetry module Adapters module Sidekiq module Middlewares module Server class TracerMiddleware def call(_worker, msg, _queue) parent_context = OpenTelemetry.propagation.text.extract(msg) tracer.in_span( msg['wrapped']&.to_s || msg['class'], attributes: { 'messaging.message_id' => msg['jid'], 'messaging.destination' => msg['queue'], }, with_parent_context: parent_context, kind: :consumer ) do |span| span.add_event(name: 'created_at', timestamp: msg['created_at']) span.add_event(name: 'enqueued_at', timestamp: msg['enqueued_at']) yield end end private def tracer Sidekiq::Adapter.instance.tracer end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
opentelemetry-adapters-sidekiq-0.4.0 | lib/opentelemetry/adapters/sidekiq/middlewares/server/tracer_middleware.rb |