Class: Datadog::CI::TestTracing::Serializers::TestV2

Inherits:
Base
  • Object
show all
Defined in:
lib/datadog/ci/test_tracing/serializers/test_v2.rb

Constant Summary collapse

CONTENT_FIELDS =
(%w[test_session_id test_module_id test_suite_id trace_id span_id] + Base::CONTENT_FIELDS).freeze
CONTENT_FIELDS_WITH_ITR_CORRELATION_ID =
(CONTENT_FIELDS + %w[itr_correlation_id]).freeze
CONTENT_MAP_SIZE =
calculate_content_map_size(CONTENT_FIELDS)
CONTENT_MAP_SIZE_WITH_ITR_CORRELATION_ID =
calculate_content_map_size(CONTENT_FIELDS_WITH_ITR_CORRELATION_ID)
REQUIRED_FIELDS =
(%w[test_session_id test_module_id test_suite_id trace_id span_id] + Base::REQUIRED_FIELDS).freeze

Constants inherited from Base

Base::MAXIMUM_DURATION_NANO, Base::MINIMUM_DURATION_NANO, Base::MINIMUM_TIMESTAMP_NANO

Instance Attribute Summary

Attributes inherited from Base

#meta, #options, #span, #trace

Instance Method Summary collapse

Methods inherited from Base

calculate_content_map_size, #duration, #error, #initialize, #metrics, #parent_id, #runtime_id, #service, #span_id, #span_type, #start, #test_module_id, #test_session_id, #test_suite_id, #to_msgpack, #trace_id, #valid?, #validate!, #validation_errors

Constructor Details

This class inherits a constructor from Datadog::CI::TestTracing::Serializers::Base

Instance Method Details

#content_fields ⇒ Object



21
22
23
24
25
# File 'lib/datadog/ci/test_tracing/serializers/test_v2.rb', line 21

def content_fields
  return CONTENT_FIELDS if itr_correlation_id.nil?

  CONTENT_FIELDS_WITH_ITR_CORRELATION_ID
end

#content_map_size ⇒ Object



27
28
29
30
31
# File 'lib/datadog/ci/test_tracing/serializers/test_v2.rb', line 27

def content_map_size
  return CONTENT_MAP_SIZE if itr_correlation_id.nil?

  CONTENT_MAP_SIZE_WITH_ITR_CORRELATION_ID
end

#event_type ⇒ Object



37
38
39
# File 'lib/datadog/ci/test_tracing/serializers/test_v2.rb', line 37

def event_type
  Ext::AppTypes::TYPE_TEST
end

#itr_correlation_id ⇒ Object



49
50
51
# File 'lib/datadog/ci/test_tracing/serializers/test_v2.rb', line 49

def itr_correlation_id
  options[:itr_correlation_id]
end

#name ⇒ Object



41
42
43
# File 'lib/datadog/ci/test_tracing/serializers/test_v2.rb', line 41

def name
  "#{@span.get_tag(Ext::Test::TAG_FRAMEWORK)}.test"
end

#resource ⇒ Object



45
46
47
# File 'lib/datadog/ci/test_tracing/serializers/test_v2.rb', line 45

def resource
  "#{@span.get_tag(Ext::Test::TAG_SUITE)}.#{@span.get_tag(Ext::Test::TAG_NAME)}"
end

#version ⇒ Object



33
34
35
# File 'lib/datadog/ci/test_tracing/serializers/test_v2.rb', line 33

def version
  2
end