Sha256: fa09177ed271f1b590f58f9adf1b90b238ce2b6ffe0e18b93bd27496f758c9dc
Contents?: true
Size: 780 Bytes
Versions: 5
Compression:
Stored size: 780 Bytes
Contents
# frozen_string_literal: true module PlainApm module Extensions module TraceId module ActiveJob attr_accessor :trace_id def initialize(*arguments) super(*arguments) # Either from request headers / a previous job, or a new trace. @trace_id = PlainApm::Extensions::TraceId.current || SecureRandom.uuid end def serialize super.update("trace_id" => trace_id) end def deserialize(job) PlainApm::Extensions::TraceId.current = job["trace_id"] super(job) end end ## # Allow tracing request ID through jobs ActiveSupport.on_load(:active_job, run_once: true) do |klass| klass.prepend(ActiveJob) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems