Sha256: 6893050cc4d7ea4c016bd428062dfa234cb29b854e8c952f92ca0472ba643e55

Contents?: true

Size: 911 Bytes

Versions: 2

Compression:

Stored size: 911 Bytes

Contents

# encoding: utf-8
# 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
  module Agent
    module DistributedTracing
      class Monitor < InboundRequestMonitor
        def on_finished_configuring(events)
          return unless NewRelic::Agent.config[:'distributed_tracing.enabled']
          events.subscribe(:before_call, &method(:on_before_call))
        end

        def on_before_call(request)
          unless NewRelic::Agent.config[:'distributed_tracing.enabled']
            NewRelic::Agent.logger.warn("Not configured to accept distributed trace headers")
            return
          end

          return unless txn = Tracer.current_transaction

          txn.distributed_tracer.accept_incoming_request(request)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
newrelic_rpm-8.10.1 lib/new_relic/agent/monitors/distributed_tracing_monitor.rb
newrelic_rpm-8.10.0 lib/new_relic/agent/monitors/distributed_tracing_monitor.rb