Sha256: 2eb4853be6fdf5640df4f5070e2444223f5e0e49e6a4a0da655c3ce840362bd6

Contents?: true

Size: 884 Bytes

Versions: 7

Compression:

Stored size: 884 Bytes

Contents

# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true

module NewRelic::Agent::Instrumentation
  module ConcurrentRuby
    module Prepend
      include NewRelic::Agent::Instrumentation::ConcurrentRuby

      def post(*args, &task)
        return super(*args, &task) unless NewRelic::Agent::Tracer.tracing_enabled?

        traced_task = add_task_tracing(*args, &task)
        super(*args, &traced_task)
      end
    end

    module ErrorPrepend
      # Uses args.last to record the error because the methods that this will be prepended to
      # look like: initialize(reason) & initialize(value, reason)
      def initialize(*args)
        NewRelic::Agent.notice_error(args.last) if args.last.is_a?(Exception)
        super
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
newrelic_rpm-9.2.2 lib/new_relic/agent/instrumentation/concurrent_ruby/prepend.rb
newrelic_rpm-9.2.1 lib/new_relic/agent/instrumentation/concurrent_ruby/prepend.rb
newrelic_rpm-9.2.0 lib/new_relic/agent/instrumentation/concurrent_ruby/prepend.rb
newrelic_rpm-9.1.0 lib/new_relic/agent/instrumentation/concurrent_ruby/prepend.rb
newrelic_rpm-9.0.0 lib/new_relic/agent/instrumentation/concurrent_ruby/prepend.rb
newrelic_rpm-8.16.0 lib/new_relic/agent/instrumentation/concurrent_ruby/prepend.rb
newrelic_rpm-8.15.0 lib/new_relic/agent/instrumentation/concurrent_ruby/prepend.rb