Class: Skylight::Probes::DelayedJob::InstrumentationProxy Private

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/skylight/probes/delayed_job.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#display_nameObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Used by Delayed::Backend::Base to determine Job#name



110
111
112
# File 'lib/skylight/probes/delayed_job.rb', line 110

def display_name
  __getobj__.respond_to?(:display_name) ? __getobj__.display_name : __getobj__.class.name
end

#performObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/skylight/probes/delayed_job.rb', line 85

def perform
  if (trace = Skylight.instrumenter&.current_trace)
    if trace.endpoint == UNKNOWN
      # At this point, deserialization was, by definition, successful.
      # So it'd be safe to set the endpoint name based on the payload
      # object here.
      trace.endpoint = Skylight::Probes::DelayedJob.payload_object_name(__getobj__)
    end

    source_meta = Skylight::Probes::DelayedJob.payload_object_source_meta(__getobj__)

    opts = {
      category: "app.delayed_job.job",
      title: format_source(*source_meta),
      meta: {
        source_location_hint: source_meta
      },
      internal: true
    }

    Skylight.instrument(opts) { __getobj__.perform }
  end
end