lib/ddtrace/tracer.rb in ddtrace-0.50.0 vs lib/ddtrace/tracer.rb in ddtrace-0.51.0

- old
+ new

@@ -1,14 +1,14 @@ require 'logger' require 'pathname' -require 'ddtrace/environment' +require 'ddtrace/ext/environment' require 'ddtrace/span' require 'ddtrace/context' require 'ddtrace/logger' require 'ddtrace/writer' -require 'ddtrace/runtime/identity' +require 'datadog/core/environment/identity' require 'ddtrace/sampler' require 'ddtrace/sampling' require 'ddtrace/correlation' require 'ddtrace/event' require 'ddtrace/utils/only_once' @@ -147,19 +147,11 @@ # A default value for service. One should really override this one # for non-root spans which have a parent. However, root spans without # a service would be invalid and rejected. def default_service - return @default_service if instance_variable_defined?(:@default_service) && @default_service - - begin - @default_service = File.basename($PROGRAM_NAME, '.*') - rescue StandardError => e - Datadog.logger.error("unable to guess default service: #{e}") - @default_service = 'ruby'.freeze - end - @default_service + @default_service ||= Datadog::Ext::Environment::FALLBACK_SERVICE_NAME end # Set the given key / value tag pair at the tracer level. These tags will be # appended to each span created by the tracer. Keys and values must be strings. # A valid example is: @@ -207,10 +199,10 @@ span = Span.new(self, name, span_options) if parent.nil? # root span @sampler.sample!(span) span.set_tag('system.pid', Process.pid) - span.set_tag(Datadog::Ext::Runtime::TAG_ID, Datadog::Runtime::Identity.id) + span.set_tag(Datadog::Ext::Runtime::TAG_ID, Datadog::Core::Environment::Identity.id) if ctx && ctx.trace_id span.trace_id = ctx.trace_id span.parent_id = ctx.span_id unless ctx.span_id.nil? end