Skip to content

Commit

Permalink
Set tracer resource in initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlaurin committed Jun 16, 2020
1 parent 5115d3d commit cf02a49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sdk/lib/opentelemetry/sdk/trace/tracer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def initialize(name, version)
@name = name
@version = version
@instrumentation_library = InstrumentationLibrary.new(name, version)
@resource = OpenTelemetry.tracer_provider.resource
end

def start_root_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil)
Expand Down Expand Up @@ -55,8 +56,7 @@ def internal_create_span(result, name, kind, trace_id, span_id, parent_span_id,
attributes = attributes&.merge(result.attributes) || result.attributes
active_trace_config = OpenTelemetry.tracer_provider.active_trace_config
active_span_processor = OpenTelemetry.tracer_provider.active_span_processor
resource = OpenTelemetry.tracer_provider.resource
Span.new(context, name, kind, parent_span_id, active_trace_config, active_span_processor, attributes, links, start_timestamp || Time.now, resource, @instrumentation_library)
Span.new(context, name, kind, parent_span_id, active_trace_config, active_span_processor, attributes, links, start_timestamp || Time.now, @resource, @instrumentation_library)
else
OpenTelemetry::Trace::Span.new(span_context: OpenTelemetry::Trace::SpanContext.new(trace_id: trace_id))
end
Expand Down

0 comments on commit cf02a49

Please sign in to comment.