Class: OpenTelemetry::SDK::Configurator
- Inherits:
-
Object
- Object
- OpenTelemetry::SDK::Configurator
- Defined in:
- lib/opentelemetry/sdk/configurator.rb
Overview
The configurator provides defaults and facilitates configuring the SDK for use.
Instance Attribute Summary collapse
-
#http_extractors ⇒ Object
writeonly
Sets the attribute http_extractors.
-
#http_injectors ⇒ Object
writeonly
Sets the attribute http_injectors.
- #logger ⇒ Object
-
#text_extractors ⇒ Object
writeonly
Sets the attribute text_extractors.
-
#text_injectors ⇒ Object
writeonly
Sets the attribute text_injectors.
Instance Method Summary collapse
-
#add_span_processor(span_processor) ⇒ Object
Add a span processor to the export pipeline.
-
#configure ⇒ Object
private
The configure method is where we define the setup process.
-
#initialize ⇒ Configurator
constructor
A new instance of Configurator.
-
#use(adapter_name, config = nil) ⇒ Object
Install an instrumentation adapter with specificied optional +config+.
-
#use_all(adapter_config_map = {}) ⇒ Object
Install all registered instrumentation.
Constructor Details
#initialize ⇒ Configurator
Returns a new instance of Configurator.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/opentelemetry/sdk/configurator.rb', line 21 def initialize @adapter_names = [] @adapter_config_map = {} @http_extractors = nil @http_injectors = nil @text_extractors = nil @text_injectors = nil @span_processors = [] @use_mode = USE_MODE_UNSPECIFIED @tracer_provider = Trace::TracerProvider.new end |
Instance Attribute Details
#http_extractors=(value) ⇒ Object (writeonly)
Sets the attribute http_extractors
18 19 20 |
# File 'lib/opentelemetry/sdk/configurator.rb', line 18 def http_extractors=(value) @http_extractors = value end |
#http_injectors=(value) ⇒ Object (writeonly)
Sets the attribute http_injectors
18 19 20 |
# File 'lib/opentelemetry/sdk/configurator.rb', line 18 def http_injectors=(value) @http_injectors = value end |
#logger ⇒ Object
33 34 35 |
# File 'lib/opentelemetry/sdk/configurator.rb', line 33 def logger @logger ||= Logger.new(STDOUT) end |
#text_extractors=(value) ⇒ Object (writeonly)
Sets the attribute text_extractors
18 19 20 |
# File 'lib/opentelemetry/sdk/configurator.rb', line 18 def text_extractors=(value) @text_extractors = value end |
#text_injectors=(value) ⇒ Object (writeonly)
Sets the attribute text_injectors
18 19 20 |
# File 'lib/opentelemetry/sdk/configurator.rb', line 18 def text_injectors=(value) @text_injectors = value end |
Instance Method Details
#add_span_processor(span_processor) ⇒ Object
Add a span processor to the export pipeline
69 70 71 |
# File 'lib/opentelemetry/sdk/configurator.rb', line 69 def add_span_processor(span_processor) @span_processors << span_processor end |
#configure ⇒ Object
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.
The configure method is where we define the setup process. This allows us to make certain guarantees about which systems and globals are setup at each stage. The setup process is:
- setup logging
- setup propagation
- setup tracer_provider and meter_provider
- install instrumentation
81 82 83 84 85 86 87 88 |
# File 'lib/opentelemetry/sdk/configurator.rb', line 81 def configure OpenTelemetry.logger = logger OpenTelemetry.correlations = CorrelationContext::Manager.new configure_propagation configure_span_processors OpenTelemetry.tracer_provider = @tracer_provider install_instrumentation end |
#use(adapter_name, config = nil) ⇒ Object
Install an instrumentation adapter with specificied optional +config+. Use can be called multiple times to install multiple instrumentation adapters. Only +use+ or +use_all+, but not both when installing instrumentation. A call to +use_all+ after +use+ will result in an exception.
45 46 47 48 49 |
# File 'lib/opentelemetry/sdk/configurator.rb', line 45 def use(adapter_name, config = nil) check_use_mode!(USE_MODE_ONE) @adapter_names << adapter_name @adapter_config_map[adapter_name] = config if config end |
#use_all(adapter_config_map = {}) ⇒ Object
Install all registered instrumentation. Configuration for specific adapters can be provided with the optional +adapter_config_map+ parameter. Only +use+ or +use_all+, but not both when installing instrumentation. A call to +use+ after +use_all+ will result in an exception.
59 60 61 62 |
# File 'lib/opentelemetry/sdk/configurator.rb', line 59 def use_all(adapter_config_map = {}) check_use_mode!(USE_MODE_ALL) @adapter_config_map = adapter_config_map end |