Line data Source code
1 : #pragma once 2 : 3 : #include "envoy/server/tracer_config.h" 4 : #include "envoy/thread_local/thread_local.h" 5 : #include "envoy/tracing/trace_driver.h" 6 : 7 : #include "source/extensions/tracers/xray/tracer.h" 8 : #include "source/extensions/tracers/xray/xray_configuration.h" 9 : 10 : namespace Envoy { 11 : namespace Extensions { 12 : namespace Tracers { 13 : namespace XRay { 14 : 15 : class Driver : public Tracing::Driver, public Logger::Loggable<Logger::Id::tracing> { 16 : public: 17 : Driver(const XRay::XRayConfiguration& config, 18 : Server::Configuration::TracerFactoryContext& context); 19 : 20 : // Tracing::Driver 21 : Tracing::SpanPtr startSpan(const Tracing::Config& config, Tracing::TraceContext& trace_context, 22 : const StreamInfo::StreamInfo& stream_info, 23 : const std::string& operation_name, 24 : Tracing::Decision tracing_decision) override; 25 : 26 : private: 27 : struct TlsTracer : ThreadLocal::ThreadLocalObject { 28 0 : TlsTracer(TracerPtr tracer, Driver& driver) : tracer_(std::move(tracer)), driver_(driver) {} 29 : TracerPtr tracer_; 30 : Driver& driver_; 31 : }; 32 : 33 : XRayConfiguration xray_config_; 34 : SamplingStrategyPtr sampling_strategy_; 35 : ThreadLocal::SlotPtr tls_slot_ptr_; 36 : }; 37 : 38 : } // namespace XRay 39 : } // namespace Tracers 40 : } // namespace Extensions 41 : } // namespace Envoy