lib/opentracing/instrumentation/sidekiq/client_middleware.rb in opentracing-instrumentation-0.1.18 vs lib/opentracing/instrumentation/sidekiq/client_middleware.rb in opentracing-instrumentation-0.2.0

- old
+ new

@@ -14,16 +14,16 @@ DEFAULT_OPERATION_NAME_BUILDER = \ Common::OperationNameBuilder.new( operation_name_template: DEFAULT_OPERATION_NAME_TEMPLATE, ) - attr_reader :tracer - attr_reader :tagger - attr_reader :error_writter - attr_reader :logger - attr_reader :span_kind - attr_reader :operation_name_builder + attr_reader :tracer, + :tagger, + :error_writter, + :logger, + :span_kind, + :operation_name_builder # rubocop:disable Metrics/ParameterLists def initialize( tracer: OpenTracing.global_tracer, tagger: JobTagger.new, @@ -39,15 +39,13 @@ @span_kind = span_kind @operation_name_builder = operation_name_builder end # rubocop:enable Metrics/ParameterLists - def call(_worker_class, job, _queue, _redis_pool) + def call(_worker_class, job, _queue, _redis_pool, &block) scope = safe_start_scope(job) inject(scope.span.context, job) - log(scope.span, job) do - yield - end + log(scope.span, job, &block) ensure safe_close_scope(scope) end private