Class: OpenTelemetry::SDK::Trace::Tracer
- Inherits:
-
Trace::Tracer
- Object
- Trace::Tracer
- OpenTelemetry::SDK::Trace::Tracer
- Defined in:
- lib/opentelemetry/sdk/trace/tracer.rb
Overview
Tracer is the SDK implementation of Trace::Tracer.
Instance Method Summary collapse
-
#initialize(name, version, tracer_provider, attributes: nil) ⇒ Tracer
constructor
private
Returns a new Tracer instance.
- #start_root_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil) ⇒ Object
- #start_span(name, with_parent: nil, attributes: nil, links: nil, start_timestamp: nil, kind: nil) ⇒ Object
Constructor Details
#initialize(name, version, tracer_provider, attributes: nil) ⇒ Tracer
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.
Returns a new OpenTelemetry::SDK::Trace::Tracer instance.
23 24 25 26 |
# File 'lib/opentelemetry/sdk/trace/tracer.rb', line 23 def initialize(name, version, tracer_provider, attributes: nil) @instrumentation_scope = InstrumentationScope.new(name, version, attributes || {}.freeze) @tracer_provider = tracer_provider end |
Instance Method Details
#start_root_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil) ⇒ Object
28 29 30 |
# File 'lib/opentelemetry/sdk/trace/tracer.rb', line 28 def start_root_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil) start_span(name, with_parent: Context.empty, attributes: attributes, links: links, start_timestamp: , kind: kind) end |
#start_span(name, with_parent: nil, attributes: nil, links: nil, start_timestamp: nil, kind: nil) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/opentelemetry/sdk/trace/tracer.rb', line 32 def start_span(name, with_parent: nil, attributes: nil, links: nil, start_timestamp: nil, kind: nil) with_parent ||= Context.current name ||= 'empty' kind ||= :internal @tracer_provider.internal_start_span(name, kind, attributes, links, , with_parent, @instrumentation_scope) end |