Sha256: 7cd2981efe9666ebeb57eb980c9542f2e6dad6d827664a08ff8baae6863c148b

Contents?: true

Size: 892 Bytes

Versions: 9

Compression:

Stored size: 892 Bytes

Contents

# frozen_string_literal: true

# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

module OpenTelemetry
  module Instrumentation
    module ActiveJob
      module Patches
        # Module to prepend to ActiveJob::Core for context propagation.
        module Base
          def self.prepended(base)
            base.class_eval do
              attr_accessor :metadata
            end
          end

          def initialize(*args)
            @metadata = {}
            super
          end
          ruby2_keywords(:initialize) if respond_to?(:ruby2_keywords, true)

          def serialize
            super.merge('metadata' => serialize_arguments(metadata))
          end

          def deserialize(job_data)
            self.metadata = deserialize_arguments(job_data['metadata'] || []).to_h
            super
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
opentelemetry-instrumentation-active_job-0.6.1 lib/opentelemetry/instrumentation/active_job/patches/base.rb
opentelemetry-instrumentation-active_job-0.6.0 lib/opentelemetry/instrumentation/active_job/patches/base.rb
opentelemetry-instrumentation-active_job-0.5.2 lib/opentelemetry/instrumentation/active_job/patches/base.rb
opentelemetry-instrumentation-active_job-0.5.1 lib/opentelemetry/instrumentation/active_job/patches/base.rb
opentelemetry-instrumentation-active_job-0.5.0 lib/opentelemetry/instrumentation/active_job/patches/base.rb
opentelemetry-instrumentation-active_job-0.4.0 lib/opentelemetry/instrumentation/active_job/patches/base.rb
opentelemetry-instrumentation-active_job-0.3.1 lib/opentelemetry/instrumentation/active_job/patches/base.rb
opentelemetry-instrumentation-active_job-0.3.0 lib/opentelemetry/instrumentation/active_job/patches/base.rb
opentelemetry-instrumentation-active_job-0.2.0 lib/opentelemetry/instrumentation/active_job/patches/base.rb