lib/opentelemetry/sdk/trace/tracer_provider.rb in opentelemetry-sdk-1.1.0 vs lib/opentelemetry/sdk/trace/tracer_provider.rb in opentelemetry-sdk-1.2.0
- old
+ new
@@ -124,19 +124,20 @@
@span_processors = @span_processors.dup.push(span_processor)
end
end
# @api private
- def internal_create_span(name, kind, trace_id, parent_span_id, attributes, links, start_timestamp, parent_context, parent_span, instrumentation_library) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
+ def internal_start_span(name, kind, attributes, links, start_timestamp, parent_context, instrumentation_scope) # rubocop:disable Metrics/MethodLength
+ parent_span = OpenTelemetry::Trace.current_span(parent_context)
parent_span_context = parent_span.context
+
if parent_span_context.valid?
parent_span_id = parent_span_context.span_id
trace_id = parent_span_context.trace_id
end
- name ||= 'empty'
+
trace_id ||= @id_generator.generate_trace_id
- kind ||= :internal
result = @sampler.should_sample?(trace_id: trace_id, parent_context: parent_context, links: links, name: name, kind: kind, attributes: attributes)
span_id = @id_generator.generate_span_id
if result.recording? && !@stopped
trace_flags = result.sampled? ? OpenTelemetry::Trace::TraceFlags::SAMPLED : OpenTelemetry::Trace::TraceFlags::DEFAULT
context = OpenTelemetry::Trace::SpanContext.new(trace_id: trace_id, span_id: span_id, trace_flags: trace_flags, tracestate: result.tracestate)
@@ -152,10 +153,10 @@
@span_processors,
attributes,
links,
start_timestamp,
@resource,
- instrumentation_library
+ instrumentation_scope
)
else
OpenTelemetry::Trace.non_recording_span(OpenTelemetry::Trace::SpanContext.new(trace_id: trace_id, span_id: span_id, tracestate: result.tracestate))
end
end