module SignalFx

This child class of HttpSender exists to allow Net::HTTP instrumentation to ignore requests made by the tracer. The tracer uses the Thrift HTTP Transport, which uses Net::HTTP internally, to send spans to the collector.

The sender spins in a separate thread to send spans. The overridden HttpSender#send_spans sets a thread variable, :http_sender_thread, which is checked with a block passed to the Net::HTTP instrumentation.

The Jaeger client's AsyncReporter creates a thread to handle sending spans on a flush interval. However, when a forking web server like Passenger forks a process that includes the tracer, the sender thread is lost.

This checks for the thread's before pushing in a span to the buffer. If it doesn't exist, it tells the instrumenter module to crate a new reporter.

If you have control over hooking into fork events, signalfx/tracing/async_reporter and reviving it should be preferred to avoid an unnecessary check with every reported span.

The default jaeger tracer doesn't expose @reporter, and attr_accessor can't be added after the fact in a child class. So this just adds an old-fashioned setter for @reporter. This also adds the set_error method that can be used to add an exception to the currently active span.