diff --git a/Steepfile b/Steepfile index 831f6f4a..825e971e 100644 --- a/Steepfile +++ b/Steepfile @@ -18,4 +18,5 @@ target :lib do library "open3" library "rspec" library "cucumber" + library "msgpack" end diff --git a/lib/datadog/ci/test_visibility/serializers/base.rb b/lib/datadog/ci/test_visibility/serializers/base.rb index c5cfaa05..ee171d4d 100644 --- a/lib/datadog/ci/test_visibility/serializers/base.rb +++ b/lib/datadog/ci/test_visibility/serializers/base.rb @@ -119,6 +119,8 @@ def duration_nano(duration) end def content_fields_count + return @content_fields_count if defined?(@content_fields_count) + res = 0 content_fields.each do |field| res += if field.is_a?(Hash) @@ -127,7 +129,7 @@ def content_fields_count 1 end end - res + @content_fields_count = res end end end diff --git a/lib/datadog/ci/test_visibility/serializers/span.rb b/lib/datadog/ci/test_visibility/serializers/span.rb index 07bd45e4..9906c8a6 100644 --- a/lib/datadog/ci/test_visibility/serializers/span.rb +++ b/lib/datadog/ci/test_visibility/serializers/span.rb @@ -9,9 +9,10 @@ module Serializers class Span < Base def content_fields @content_fields ||= [ - "trace_id", "span_id", "parent_id", "name", - "resource", "service", "error", "start", - "duration", "meta", "metrics", + "trace_id", "span_id", "parent_id", + "name", "resource", "service", + "error", "start", "duration", + "meta", "metrics", "type" => "span_type" ] end diff --git a/lib/datadog/ci/test_visibility/serializers/test_v1.rb b/lib/datadog/ci/test_visibility/serializers/test_v1.rb index 7200e75b..1c3684c9 100644 --- a/lib/datadog/ci/test_visibility/serializers/test_v1.rb +++ b/lib/datadog/ci/test_visibility/serializers/test_v1.rb @@ -10,8 +10,10 @@ module Serializers class TestV1 < Base def content_fields @content_fields ||= [ - "trace_id", "span_id", "name", "resource", "service", - "start", "duration", "meta", "metrics", "error", + "trace_id", "span_id", + "name", "resource", "service", + "error", "start", "duration", + "meta", "metrics", "type" => "span_type" ] end diff --git a/lib/datadog/ci/transport/http.rb b/lib/datadog/ci/transport/http.rb index 0d862449..3584b952 100644 --- a/lib/datadog/ci/transport/http.rb +++ b/lib/datadog/ci/transport/http.rb @@ -1,12 +1,12 @@ -# frozen_string_literal: true +# # frozen_string_literal: true -module Datadog - module CI - module Transport - class HTTP - def initialize - end - end - end - end -end +# module Datadog +# module CI +# module Transport +# class HTTP +# def initialize +# end +# end +# end +# end +# end diff --git a/sig/datadog/ci/test_visibility/events.rbs b/sig/datadog/ci/test_visibility/events.rbs deleted file mode 100644 index dd805153..00000000 --- a/sig/datadog/ci/test_visibility/events.rbs +++ /dev/null @@ -1,11 +0,0 @@ -module Datadog - module CI - module TestVisibility - module Events - def self?.extract_from_trace: (untyped trace) -> untyped - - def self?.convert_span: (untyped span) -> untyped - end - end - end -end diff --git a/sig/datadog/ci/test_visibility/events/event.rbs b/sig/datadog/ci/test_visibility/events/event.rbs deleted file mode 100644 index 4261f820..00000000 --- a/sig/datadog/ci/test_visibility/events/event.rbs +++ /dev/null @@ -1,13 +0,0 @@ -module Datadog - module CI - module TestVisibility - module Events - class Event - def initialize: () -> void - - def to_msgpack: () -> nil - end - end - end - end -end diff --git a/sig/datadog/ci/test_visibility/events/span.rbs b/sig/datadog/ci/test_visibility/events/span.rbs deleted file mode 100644 index be40dff5..00000000 --- a/sig/datadog/ci/test_visibility/events/span.rbs +++ /dev/null @@ -1,11 +0,0 @@ -module Datadog - module CI - module TestVisibility - module Events - class Span < Event - def initialize: () -> void - end - end - end - end -end diff --git a/sig/datadog/ci/test_visibility/events/test.rbs b/sig/datadog/ci/test_visibility/events/test.rbs deleted file mode 100644 index e179a9e7..00000000 --- a/sig/datadog/ci/test_visibility/events/test.rbs +++ /dev/null @@ -1,11 +0,0 @@ -module Datadog - module CI - module TestVisibility - module Events - class Test < Event - def initialize: () -> void - end - end - end - end -end diff --git a/sig/datadog/ci/test_visibility/serializers.rbs b/sig/datadog/ci/test_visibility/serializers.rbs new file mode 100644 index 00000000..c8adc17e --- /dev/null +++ b/sig/datadog/ci/test_visibility/serializers.rbs @@ -0,0 +1,10 @@ +module Datadog + module CI + module TestVisibility + module Serializers + def self?.convert_trace_to_serializable_events: (Datadog::Tracing::TraceSegment trace) -> untyped + def self?.convert_span_to_serializable_event: (Datadog::Tracing::TraceSegment trace, Datadog::Tracing::Span span) -> untyped + end + end + end +end diff --git a/sig/datadog/ci/test_visibility/serializers/base.rbs b/sig/datadog/ci/test_visibility/serializers/base.rbs new file mode 100644 index 00000000..3257c2f3 --- /dev/null +++ b/sig/datadog/ci/test_visibility/serializers/base.rbs @@ -0,0 +1,58 @@ +module Datadog + module CI + module TestVisibility + module Serializers + class Base + @content_fields_count: Integer + + attr_reader trace: Datadog::Tracing::TraceSegment + attr_reader span: Datadog::Tracing::Span + + def initialize: (Datadog::Tracing::TraceSegment trace, Datadog::Tracing::Span span) -> void + + def to_msgpack: (?untyped? packer) -> untyped + + def content_fields: () -> ::Array[String | Hash[String, String]] + + def runtime_id: () -> String + + def trace_id: () -> String + + def span_id: () -> String + + def parent_id: () -> String + + def type: () -> nil + + def version: () -> 1 + + def span_type: () -> String + + def name: () -> String + + def resource: () -> String + + def service: () -> String + + def start: () -> Integer + + def duration: () -> Integer + + def meta: () -> Hash[String, untyped] + + def metrics: () -> Hash[String, untyped] + + def error: () -> Integer + + private + + def write_field: (untyped packer, String field_name, ?String? method) -> untyped + def time_nano: (Time time) -> Integer + def duration_nano: (Integer duration) -> Integer + + def content_fields_count: () -> Integer + end + end + end + end +end diff --git a/sig/datadog/ci/test_visibility/serializers/span.rbs b/sig/datadog/ci/test_visibility/serializers/span.rbs new file mode 100644 index 00000000..1d18eec0 --- /dev/null +++ b/sig/datadog/ci/test_visibility/serializers/span.rbs @@ -0,0 +1,14 @@ +module Datadog + module CI + module TestVisibility + module Serializers + class Span < Base + @content_fields: Array[String | Hash[String, String]] + def content_fields: () -> Array[String | Hash[String, String]] + + def type: () -> "span" + end + end + end + end +end diff --git a/sig/datadog/ci/test_visibility/serializers/test_v1.rbs b/sig/datadog/ci/test_visibility/serializers/test_v1.rbs new file mode 100644 index 00000000..f66ee815 --- /dev/null +++ b/sig/datadog/ci/test_visibility/serializers/test_v1.rbs @@ -0,0 +1,18 @@ +module Datadog + module CI + module TestVisibility + module Serializers + class TestV1 < Base + @content_fields: Array[String | Hash[String, String]] + def content_fields: () -> Array[String | Hash[String, String]] + + def type: () -> "test" + + def name: () -> ::String + + def resource: () -> ::String + end + end + end + end +end diff --git a/sig/datadog/ci/test_visibility/transport.rbs b/sig/datadog/ci/test_visibility/transport.rbs deleted file mode 100644 index 204ae3e1..00000000 --- a/sig/datadog/ci/test_visibility/transport.rbs +++ /dev/null @@ -1,18 +0,0 @@ -module Datadog - module CI - module TestVisibility - class Transport - def initialize: () -> void - - def send_traces: (untyped traces) -> untyped - - private - class Payload - def initialize: (untyped events) -> void - - def to_msgpack: () -> nil - end - end - end - end -end diff --git a/vendor/rbs/ddtrace/0/datadog/tracing/span.rbs b/vendor/rbs/ddtrace/0/datadog/tracing/span.rbs index 9adb31f1..0d749106 100644 --- a/vendor/rbs/ddtrace/0/datadog/tracing/span.rbs +++ b/vendor/rbs/ddtrace/0/datadog/tracing/span.rbs @@ -4,6 +4,20 @@ module Datadog attr_accessor span_id: Integer def set_tag: (String key, ?untyped? value) -> void + def get_tag: (String key) -> String? + def type: () -> String + def id: () -> String + def trace_id: () -> String + def parent_id: () -> String + def name: () -> String + def resource: () -> String + def service: () -> String + def status: () -> Integer + def start_time: () -> Time + def end_time: () -> Time + def duration: () -> Integer + def meta: () -> Hash[String, untyped] + def metrics: () -> Hash[String, untyped] end end end diff --git a/vendor/rbs/msgpack/0/message_pack/packer.rbs b/vendor/rbs/msgpack/0/message_pack/packer.rbs new file mode 100644 index 00000000..7d1419dc --- /dev/null +++ b/vendor/rbs/msgpack/0/message_pack/packer.rbs @@ -0,0 +1,9 @@ +module MessagePack + class Packer + def initialize: () -> void + + def write: (String input) -> self + def write_map_header: (Integer keys_number) -> self + def write_array_header: (Integer keys_number) -> self + end +end