Class: OpenTelemetry::SDK::Trace::Tracer

Inherits:
Trace::Tracer
  • Object
show all
Defined in:
lib/opentelemetry/sdk/trace/tracer.rb

Overview

Tracer is the SDK implementation of Trace::Tracer.

Instance Method Summary collapse

Constructor Details

#initialize(name, version, tracer_provider) ⇒ 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.

Parameters:

  • name (String)

    Instrumentation package name

  • version (String)

    Instrumentation package version

  • tracer_provider (TracerProvider)

    TracerProvider that initialized the tracer



21
22
23
24
# File 'lib/opentelemetry/sdk/trace/tracer.rb', line 21

def initialize(name, version, tracer_provider)
  @instrumentation_scope = InstrumentationScope.new(name, version)
  @tracer_provider = tracer_provider
end

Instance Method Details

#start_root_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil) ⇒ Object



26
27
28
# File 'lib/opentelemetry/sdk/trace/tracer.rb', line 26

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: start_timestamp, kind: kind)
end

#start_span(name, with_parent: nil, attributes: nil, links: nil, start_timestamp: nil, kind: nil) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/opentelemetry/sdk/trace/tracer.rb', line 30

def start_span(name, with_parent: nil, attributes: nil, links: nil, start_timestamp: nil, kind: nil)
  name ||= 'empty'
  kind ||= :internal
  with_parent ||= Context.current

  @tracer_provider.internal_start_span(name, kind, attributes, links, start_timestamp, with_parent, @instrumentation_scope)
end