Module: OpenTelemetry::Instrumentation::ActiveJob::Patches::Base
- Defined in:
- lib/opentelemetry/instrumentation/active_job/patches/base.rb
Overview
Module to prepend to ActiveJob::Core for context propagation.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.prepended(base) ⇒ Object
13 14 15 16 17 |
# File 'lib/opentelemetry/instrumentation/active_job/patches/base.rb', line 13 def self.prepended(base) base.class_eval do attr_accessor :__otel_headers end end |
Instance Method Details
#deserialize(job_data) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/opentelemetry/instrumentation/active_job/patches/base.rb', line 36 def deserialize(job_data) begin @__otel_headers = deserialize_arguments(job_data.delete('__otel_headers') || []).to_h rescue StandardError => e OpenTelemetry.handle_error(exception: e) end super end |
#initialize ⇒ Object
19 20 21 22 |
# File 'lib/opentelemetry/instrumentation/active_job/patches/base.rb', line 19 def initialize(...) @__otel_headers = {} super end |
#serialize ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/opentelemetry/instrumentation/active_job/patches/base.rb', line 24 def serialize = super begin .merge!('__otel_headers' => serialize_arguments(@__otel_headers)) rescue StandardError => e OpenTelemetry.handle_error(exception: e) end end |