Sha256: 1c7f2e551b9ed30ef834f190a153b5f0ccdd0cb5023a961e36bedcd0cc8dbb5c
Contents?: true
Size: 1.14 KB
Versions: 9
Compression:
Stored size: 1.14 KB
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 :__otel_headers end end def initialize(...) @__otel_headers = {} super end def serialize message = super begin message.merge!('__otel_headers' => serialize_arguments(@__otel_headers)) rescue StandardError => e OpenTelemetry.handle_error(exception: e) end message end 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 end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems