Class: Observable::Instrumenter
- Inherits:
-
Object
- Object
- Observable::Instrumenter
- Defined in:
- lib/observable/instrumenter.rb
Defined Under Namespace
Classes: ArgumentExtractor, CallerInformation, InstrumentationError
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#last_captured_namespace ⇒ Object
readonly
Returns the value of attribute last_captured_namespace.
Instance Method Summary collapse
-
#initialize(tracer: nil, config: nil) ⇒ Instrumenter
constructor
A new instance of Instrumenter.
- #instrument(caller_binding = nil, &block) ⇒ Object
Constructor Details
#initialize(tracer: nil, config: nil) ⇒ Instrumenter
Returns a new instance of Instrumenter.
8 9 10 11 |
# File 'lib/observable/instrumenter.rb', line 8 def initialize(tracer: nil, config: nil) @config = config || Configuration.config @tracer = tracer || OpenTelemetry.tracer_provider.tracer(@config.tracer_name) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/observable/instrumenter.rb', line 6 def config @config end |
#last_captured_namespace ⇒ Object (readonly)
Returns the value of attribute last_captured_namespace.
6 7 8 |
# File 'lib/observable/instrumenter.rb', line 6 def last_captured_namespace @last_captured_namespace end |
Instance Method Details
#instrument(caller_binding = nil, &block) ⇒ Object
13 14 15 16 17 |
# File 'lib/observable/instrumenter.rb', line 13 def instrument(caller_binding = nil, &block) @caller_binding = caller_binding caller_info = extract_caller_information create_instrumented_span(caller_info, &block) end |