Class: Datadog::Tracing::Correlation::Identifier

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/tracing/correlation.rb

Overview

Represents current trace state with key identifiers

Constant Summary collapse

LOG_ATTR_ENV =
'dd.env'.freeze
LOG_ATTR_SERVICE =
'dd.service'.freeze
LOG_ATTR_SPAN_ID =
'dd.span_id'.freeze
LOG_ATTR_TRACE_ID =
'dd.trace_id'.freeze
LOG_ATTR_VERSION =
'dd.version'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



19
20
21
# File 'lib/datadog/tracing/correlation.rb', line 19

def env
  @env
end

#serviceObject (readonly)

Returns the value of attribute service.



19
20
21
# File 'lib/datadog/tracing/correlation.rb', line 19

def service
  @service
end

#span_idObject (readonly)

Returns the value of attribute span_id.



19
20
21
# File 'lib/datadog/tracing/correlation.rb', line 19

def span_id
  @span_id
end

#span_nameObject (readonly)

Returns the value of attribute span_name.



19
20
21
# File 'lib/datadog/tracing/correlation.rb', line 19

def span_name
  @span_name
end

#span_resourceObject (readonly)

Returns the value of attribute span_resource.



19
20
21
# File 'lib/datadog/tracing/correlation.rb', line 19

def span_resource
  @span_resource
end

#span_serviceObject (readonly)

Returns the value of attribute span_service.



19
20
21
# File 'lib/datadog/tracing/correlation.rb', line 19

def span_service
  @span_service
end

#span_typeObject (readonly)

Returns the value of attribute span_type.



19
20
21
# File 'lib/datadog/tracing/correlation.rb', line 19

def span_type
  @span_type
end

#trace_idObject (readonly)

Returns the value of attribute trace_id.



19
20
21
# File 'lib/datadog/tracing/correlation.rb', line 19

def trace_id
  @trace_id
end

#trace_nameObject (readonly)

Returns the value of attribute trace_name.



19
20
21
# File 'lib/datadog/tracing/correlation.rb', line 19

def trace_name
  @trace_name
end

#trace_resourceObject (readonly)

Returns the value of attribute trace_resource.



19
20
21
# File 'lib/datadog/tracing/correlation.rb', line 19

def trace_resource
  @trace_resource
end

#trace_serviceObject (readonly)

Returns the value of attribute trace_service.



19
20
21
# File 'lib/datadog/tracing/correlation.rb', line 19

def trace_service
  @trace_service
end

#versionObject (readonly)

Returns the value of attribute version.



19
20
21
# File 'lib/datadog/tracing/correlation.rb', line 19

def version
  @version
end

Instance Method Details

#to_log_formatObject



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/datadog/tracing/correlation.rb', line 63

def to_log_format
  @log_format ||= begin
    attributes = []
    attributes << "#{LOG_ATTR_ENV}=#{env}" unless env.nil?
    attributes << "#{LOG_ATTR_SERVICE}=#{service}"
    attributes << "#{LOG_ATTR_VERSION}=#{version}" unless version.nil?
    attributes << "#{LOG_ATTR_TRACE_ID}=#{trace_id}"
    attributes << "#{LOG_ATTR_SPAN_ID}=#{span_id}"
    attributes.join(' ')
  end
end