datadog-ci 0.3.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +33 -1
- data/README.md +36 -36
- data/lib/datadog/ci/configuration/components.rb +9 -0
- data/lib/datadog/ci/context/local.rb +50 -0
- data/lib/datadog/ci/contrib/cucumber/formatter.rb +23 -29
- data/lib/datadog/ci/contrib/minitest/hooks.rb +16 -25
- data/lib/datadog/ci/contrib/rspec/example.rb +14 -18
- data/lib/datadog/ci/ext/environment/extractor.rb +5 -10
- data/lib/datadog/ci/ext/environment/providers/github_actions.rb +13 -4
- data/lib/datadog/ci/recorder.rb +82 -46
- data/lib/datadog/ci/span.rb +107 -0
- data/lib/datadog/ci/test.rb +26 -0
- data/lib/datadog/ci/utils/url.rb +15 -0
- data/lib/datadog/ci/version.rb +2 -2
- data/lib/datadog/ci.rb +193 -4
- data/sig/datadog/ci/configuration/components.rbs +4 -0
- data/sig/datadog/ci/context/local.rbs +21 -0
- data/sig/datadog/ci/ext/environment/extractor.rbs +0 -2
- data/sig/datadog/ci/ext/environment/providers/github_actions.rbs +5 -0
- data/sig/datadog/ci/recorder.rbs +20 -8
- data/sig/datadog/ci/span.rbs +35 -0
- data/sig/datadog/ci/test.rbs +7 -0
- data/sig/datadog/ci/utils/url.rbs +9 -0
- data/sig/datadog/ci.rbs +15 -3
- metadata +10 -2
data/lib/datadog/ci/recorder.rb
CHANGED
@@ -1,82 +1,118 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "datadog/tracing"
|
4
|
-
|
4
|
+
|
5
|
+
require "rbconfig"
|
5
6
|
|
6
7
|
require_relative "ext/app_types"
|
7
8
|
require_relative "ext/test"
|
8
9
|
require_relative "ext/environment"
|
9
10
|
|
10
|
-
|
11
|
+
require_relative "context/local"
|
12
|
+
|
13
|
+
require_relative "span"
|
14
|
+
require_relative "test"
|
11
15
|
|
12
16
|
module Datadog
|
13
17
|
module CI
|
14
18
|
# Common behavior for CI tests
|
15
|
-
|
19
|
+
class Recorder
|
20
|
+
attr_reader :environment_tags
|
21
|
+
|
22
|
+
def initialize
|
23
|
+
@environment_tags = Ext::Environment.tags(ENV).freeze
|
24
|
+
@local_context = Context::Local.new
|
25
|
+
end
|
26
|
+
|
16
27
|
# Creates a new span for a CI test
|
17
|
-
def
|
28
|
+
def trace_test(test_name, service_name: nil, operation_name: "test", tags: {}, &block)
|
18
29
|
span_options = {
|
30
|
+
resource: test_name,
|
31
|
+
service: service_name,
|
19
32
|
span_type: Ext::AppTypes::TYPE_TEST
|
20
|
-
}
|
33
|
+
}
|
34
|
+
|
35
|
+
tags[Ext::Test::TAG_NAME] = test_name
|
21
36
|
|
22
|
-
if
|
23
|
-
|
24
|
-
|
25
|
-
|
37
|
+
if block
|
38
|
+
Datadog::Tracing.trace(operation_name, **span_options) do |tracer_span, trace|
|
39
|
+
set_trace_origin(trace)
|
40
|
+
|
41
|
+
test = build_test(tracer_span, tags)
|
42
|
+
|
43
|
+
@local_context.activate_test!(test) do
|
44
|
+
block.call(test)
|
45
|
+
end
|
26
46
|
end
|
27
47
|
else
|
28
|
-
|
29
|
-
trace =
|
30
|
-
|
31
|
-
|
48
|
+
tracer_span = Datadog::Tracing.trace(operation_name, **span_options)
|
49
|
+
trace = Datadog::Tracing.active_trace
|
50
|
+
|
51
|
+
set_trace_origin(trace)
|
52
|
+
|
53
|
+
test = build_test(tracer_span, tags)
|
54
|
+
@local_context.activate_test!(test)
|
55
|
+
test
|
32
56
|
end
|
33
57
|
end
|
34
58
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
trace.origin = Ext::Test::CONTEXT_ORIGIN if trace
|
41
|
-
::Datadog::Tracing::Contrib::Analytics.set_measured(span)
|
42
|
-
span.set_tag(Ext::Test::TAG_SPAN_KIND, Ext::AppTypes::TYPE_TEST)
|
59
|
+
def trace(span_type, span_name, tags: {}, &block)
|
60
|
+
span_options = {
|
61
|
+
resource: span_name,
|
62
|
+
span_type: span_type
|
63
|
+
}
|
43
64
|
|
44
|
-
|
45
|
-
|
46
|
-
|
65
|
+
if block
|
66
|
+
Datadog::Tracing.trace(span_name, **span_options) do |tracer_span, trace|
|
67
|
+
block.call(build_span(tracer_span, tags))
|
68
|
+
end
|
69
|
+
else
|
70
|
+
tracer_span = Datadog::Tracing.trace(span_name, **span_options)
|
47
71
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
span.set_tag(Ext::Test::TAG_NAME, tags[:test_name]) if tags[:test_name]
|
52
|
-
span.set_tag(Ext::Test::TAG_SUITE, tags[:test_suite]) if tags[:test_suite]
|
53
|
-
span.set_tag(Ext::Test::TAG_TYPE, tags[:test_type]) if tags[:test_type]
|
72
|
+
build_span(tracer_span, tags)
|
73
|
+
end
|
74
|
+
end
|
54
75
|
|
55
|
-
|
76
|
+
def active_test
|
77
|
+
@local_context.active_test
|
78
|
+
end
|
56
79
|
|
57
|
-
|
80
|
+
def deactivate_test(test)
|
81
|
+
@local_context.deactivate_test!(test)
|
58
82
|
end
|
59
83
|
|
60
|
-
def
|
61
|
-
|
84
|
+
def active_span
|
85
|
+
tracer_span = Datadog::Tracing.active_span
|
86
|
+
Span.new(tracer_span) if tracer_span
|
62
87
|
end
|
63
88
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
89
|
+
private
|
90
|
+
|
91
|
+
# Sets trace's origin to ciapp-test
|
92
|
+
def set_trace_origin(trace)
|
93
|
+
trace.origin = Ext::Test::CONTEXT_ORIGIN if trace
|
68
94
|
end
|
69
95
|
|
70
|
-
def
|
71
|
-
|
72
|
-
|
96
|
+
def build_test(tracer_span, tags)
|
97
|
+
test = Test.new(tracer_span)
|
98
|
+
|
99
|
+
test.set_default_tags
|
100
|
+
test.set_environment_runtime_tags
|
101
|
+
|
102
|
+
test.set_tags(tags)
|
103
|
+
test.set_tags(environment_tags)
|
104
|
+
|
105
|
+
test
|
73
106
|
end
|
74
107
|
|
75
|
-
|
76
|
-
span.
|
77
|
-
|
78
|
-
span.
|
79
|
-
span.
|
108
|
+
def build_span(tracer_span, tags)
|
109
|
+
span = Span.new(tracer_span)
|
110
|
+
|
111
|
+
span.set_default_tags
|
112
|
+
span.set_environment_runtime_tags
|
113
|
+
span.set_tags(tags)
|
114
|
+
|
115
|
+
span
|
80
116
|
end
|
81
117
|
end
|
82
118
|
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "ext/test"
|
4
|
+
|
5
|
+
module Datadog
|
6
|
+
module CI
|
7
|
+
# Represents a single part of a test run.
|
8
|
+
# Could be a session, suite, test, or any custom span.
|
9
|
+
#
|
10
|
+
# @public_api
|
11
|
+
class Span
|
12
|
+
attr_reader :tracer_span
|
13
|
+
|
14
|
+
def initialize(tracer_span)
|
15
|
+
@tracer_span = tracer_span
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [String] the name of the span.
|
19
|
+
def name
|
20
|
+
tracer_span.name
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [String] the type of the span (for example "test" or type that was provided to [Datadog::CI.trace]).
|
24
|
+
def span_type
|
25
|
+
tracer_span.type
|
26
|
+
end
|
27
|
+
|
28
|
+
# Sets the status of the span to "pass".
|
29
|
+
# @return [void]
|
30
|
+
def passed!
|
31
|
+
tracer_span.set_tag(Ext::Test::TAG_STATUS, Ext::Test::Status::PASS)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Sets the status of the span to "fail".
|
35
|
+
# @param [Exception] exception the exception that caused the test to fail.
|
36
|
+
# @return [void]
|
37
|
+
def failed!(exception: nil)
|
38
|
+
tracer_span.status = 1
|
39
|
+
tracer_span.set_tag(Ext::Test::TAG_STATUS, Ext::Test::Status::FAIL)
|
40
|
+
tracer_span.set_error(exception) unless exception.nil?
|
41
|
+
end
|
42
|
+
|
43
|
+
# Sets the status of the span to "skip".
|
44
|
+
# @param [Exception] exception the exception that caused the test to fail.
|
45
|
+
# @param [String] reason the reason why the test was skipped.
|
46
|
+
# @return [void]
|
47
|
+
def skipped!(exception: nil, reason: nil)
|
48
|
+
tracer_span.set_tag(Ext::Test::TAG_STATUS, Ext::Test::Status::SKIP)
|
49
|
+
tracer_span.set_error(exception) unless exception.nil?
|
50
|
+
tracer_span.set_tag(Ext::Test::TAG_SKIP_REASON, reason) unless reason.nil?
|
51
|
+
end
|
52
|
+
|
53
|
+
# Gets tag value by key.
|
54
|
+
# @param [String] key the key of the tag.
|
55
|
+
# @return [String] the value of the tag.
|
56
|
+
def get_tag(key)
|
57
|
+
tracer_span.get_tag(key)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Sets tag value by key.
|
61
|
+
# @param [String] key the key of the tag.
|
62
|
+
# @param [String] value the value of the tag.
|
63
|
+
# @return [void]
|
64
|
+
def set_tag(key, value)
|
65
|
+
tracer_span.set_tag(key, value)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Sets metric value by key.
|
69
|
+
# @param [String] key the key of the metric.
|
70
|
+
# @param [Numeric] value the value of the metric.
|
71
|
+
# @return [void]
|
72
|
+
def set_metric(key, value)
|
73
|
+
tracer_span.set_metric(key, value)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Finishes the span.
|
77
|
+
# @return [void]
|
78
|
+
def finish
|
79
|
+
tracer_span.finish
|
80
|
+
end
|
81
|
+
|
82
|
+
# Sets multiple tags at once.
|
83
|
+
# @param [Hash[String, String]] tags the tags to set.
|
84
|
+
# @return [void]
|
85
|
+
def set_tags(tags)
|
86
|
+
tags.each do |key, value|
|
87
|
+
tracer_span.set_tag(key, value)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def set_environment_runtime_tags
|
92
|
+
tracer_span.set_tag(Ext::Test::TAG_OS_ARCHITECTURE, ::RbConfig::CONFIG["host_cpu"])
|
93
|
+
tracer_span.set_tag(Ext::Test::TAG_OS_PLATFORM, ::RbConfig::CONFIG["host_os"])
|
94
|
+
tracer_span.set_tag(Ext::Test::TAG_RUNTIME_NAME, Core::Environment::Ext::LANG_ENGINE)
|
95
|
+
tracer_span.set_tag(Ext::Test::TAG_RUNTIME_VERSION, Core::Environment::Ext::ENGINE_VERSION)
|
96
|
+
end
|
97
|
+
|
98
|
+
def set_default_tags
|
99
|
+
tracer_span.set_tag(Ext::Test::TAG_SPAN_KIND, Ext::AppTypes::TYPE_TEST)
|
100
|
+
end
|
101
|
+
|
102
|
+
def to_s
|
103
|
+
"#{self.class}(name:#{name},tracer_span:#{@tracer_span})"
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "span"
|
4
|
+
|
5
|
+
module Datadog
|
6
|
+
module CI
|
7
|
+
# Represents a single part of a test run.
|
8
|
+
# Could be a session, suite, test, or any custom span.
|
9
|
+
#
|
10
|
+
# @public_api
|
11
|
+
class Test < Span
|
12
|
+
# @return [String] the name of the test.
|
13
|
+
def name
|
14
|
+
get_tag(Ext::Test::TAG_NAME)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Finishes the current test.
|
18
|
+
# @return [void]
|
19
|
+
def finish
|
20
|
+
super
|
21
|
+
|
22
|
+
CI.deactivate_test(self)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/datadog/ci/version.rb
CHANGED
data/lib/datadog/ci.rb
CHANGED
@@ -5,11 +5,200 @@ require_relative "ci/version"
|
|
5
5
|
require "datadog/core"
|
6
6
|
|
7
7
|
module Datadog
|
8
|
-
#
|
9
|
-
#
|
8
|
+
# Datadog CI visibility public API.
|
9
|
+
#
|
10
|
+
# @public_api
|
10
11
|
module CI
|
11
|
-
class
|
12
|
-
|
12
|
+
class << self
|
13
|
+
# Return a {Datadog::CI::Test ci_test} that will trace a test called `test_name`.
|
14
|
+
# Raises an error if a test is already active.
|
15
|
+
#
|
16
|
+
# You could trace your test using a <tt>do-block</tt> like:
|
17
|
+
#
|
18
|
+
# ```
|
19
|
+
# Datadog::CI.trace_test(
|
20
|
+
# "test_add_two_numbers",
|
21
|
+
# service_name: "my-web-site-tests",
|
22
|
+
# operation_name: "test",
|
23
|
+
# tags: { Datadog::CI::Ext::Test::TAG_FRAMEWORK => "my-test-framework" }
|
24
|
+
# ) do |ci_test|
|
25
|
+
# result = run_test
|
26
|
+
#
|
27
|
+
# if result.ok?
|
28
|
+
# ci_test.passed!
|
29
|
+
# else
|
30
|
+
# ci_test.failed!(exception: result.exception)
|
31
|
+
# end
|
32
|
+
# end
|
33
|
+
# ```
|
34
|
+
#
|
35
|
+
# The {#trace_test} method can also be used without a block in this way:
|
36
|
+
# ```
|
37
|
+
# ci_test = Datadog::CI.trace_test(
|
38
|
+
# "test_add_two_numbers',
|
39
|
+
# service: "my-web-site-tests",
|
40
|
+
# operation_name: "test",
|
41
|
+
# tags: { Datadog::CI::Ext::Test::TAG_FRAMEWORK => "my-test-framework" }
|
42
|
+
# )
|
43
|
+
# run_test
|
44
|
+
# ci_test.finish
|
45
|
+
# ```
|
46
|
+
#
|
47
|
+
# Remember that in this case, calling {Datadog::CI::Test#finish} is mandatory.
|
48
|
+
#
|
49
|
+
# @param [String] test_name {Datadog::CI::Test} name (example: "test_add_two_numbers").
|
50
|
+
# @param [String] operation_name defines label for a test span in trace view ("test" if it's missing)
|
51
|
+
# @param [String] service_name the service name for this test
|
52
|
+
# @param [Hash<String,String>] tags extra tags which should be added to the test.
|
53
|
+
# @return [Object] If a block is provided, returns the result of the block execution.
|
54
|
+
# @return [Datadog::CI::Test] If no block is provided, returns the active,
|
55
|
+
# unfinished {Datadog::CI::Test}.
|
56
|
+
# @yield Optional block where new newly created {Datadog::CI::Test} captures the execution.
|
57
|
+
# @yieldparam [Datadog::CI::Test] ci_test the newly created and active [Datadog::CI::Test]
|
58
|
+
#
|
59
|
+
# @public_api
|
60
|
+
def trace_test(test_name, service_name: nil, operation_name: "test", tags: {}, &block)
|
61
|
+
recorder.trace_test(test_name, service_name: service_name, operation_name: operation_name, tags: tags, &block)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Same as {#trace_test} but it does not accept a block.
|
65
|
+
# Raises an error if a test is already active.
|
66
|
+
#
|
67
|
+
# Usage:
|
68
|
+
#
|
69
|
+
# ```
|
70
|
+
# ci_test = Datadog::CI.start_test(
|
71
|
+
# "test_add_two_numbers',
|
72
|
+
# service: "my-web-site-tests",
|
73
|
+
# operation_name: "test",
|
74
|
+
# tags: { Datadog::CI::Ext::Test::TAG_FRAMEWORK => "my-test-framework" }
|
75
|
+
# )
|
76
|
+
# run_test
|
77
|
+
# ci_test.finish
|
78
|
+
# ```
|
79
|
+
#
|
80
|
+
# @param [String] test_name {Datadog::CI::Test} name (example: "test_add_two_numbers").
|
81
|
+
# @param [String] operation_name the resource this span refers, or `test` if it's missing
|
82
|
+
# @param [String] service_name the service name for this span.
|
83
|
+
# @param [Hash<String,String>] tags extra tags which should be added to the test.
|
84
|
+
# @return [Datadog::CI::Test] Returns the active, unfinished {Datadog::CI::Test}.
|
85
|
+
#
|
86
|
+
# @public_api
|
87
|
+
def start_test(test_name, service_name: nil, operation_name: "test", tags: {})
|
88
|
+
recorder.trace_test(test_name, service_name: service_name, operation_name: operation_name, tags: tags)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Trace any custom span inside a test. For example, you could trace:
|
92
|
+
# - cucumber step
|
93
|
+
# - database query
|
94
|
+
# - any custom operation you want to see in your trace view
|
95
|
+
#
|
96
|
+
# You can use thi method with a <tt>do-block</tt> like:
|
97
|
+
#
|
98
|
+
# ```
|
99
|
+
# Datadog::CI.trace(
|
100
|
+
# "step",
|
101
|
+
# "Given I have 42 cucumbers",
|
102
|
+
# tags: {}
|
103
|
+
# ) do
|
104
|
+
# run_operation
|
105
|
+
# end
|
106
|
+
# ```
|
107
|
+
#
|
108
|
+
# The {#trace} method can also be used without a block in this way:
|
109
|
+
# ```
|
110
|
+
# ci_span = Datadog::CI.trace(
|
111
|
+
# "step",
|
112
|
+
# "Given I have 42 cucumbers",
|
113
|
+
# tags: {}
|
114
|
+
# )
|
115
|
+
# run_test
|
116
|
+
# ci_span.finish
|
117
|
+
# ```
|
118
|
+
# Remember that in this case, calling {Datadog::CI::Span#finish} is mandatory.
|
119
|
+
#
|
120
|
+
# @param [String] span_type custom, user-defined span type (for example "step" or "query").
|
121
|
+
# @param [String] span_name the resource this span refers, or `test` if it's missing
|
122
|
+
# @param [Hash<String,String>] tags extra tags which should be added to the span.
|
123
|
+
# @return [Object] If a block is provided, returns the result of the block execution.
|
124
|
+
# @return [Datadog::CI::Span] If no block is provided, returns the active,
|
125
|
+
# unfinished {Datadog::CI::Span}.
|
126
|
+
# @yield Optional block where new newly created {Datadog::CI::Span} captures the execution.
|
127
|
+
# @yieldparam [Datadog::CI::Span] ci_span the newly created and active [Datadog::CI::Span]
|
128
|
+
#
|
129
|
+
# @public_api
|
130
|
+
def trace(span_type, span_name, tags: {}, &block)
|
131
|
+
recorder.trace(span_type, span_name, tags: tags, &block)
|
132
|
+
end
|
133
|
+
|
134
|
+
# The active, unfinished custom span if it matches given type.
|
135
|
+
# If no span is active, or if the active span is not a custom span with given type, returns nil.
|
136
|
+
#
|
137
|
+
# The active span belongs to an {.active_test}.
|
138
|
+
#
|
139
|
+
# Usage:
|
140
|
+
#
|
141
|
+
# ```
|
142
|
+
# # start span
|
143
|
+
# Datadog::CI.trace(
|
144
|
+
# "step",
|
145
|
+
# "Given I have 42 cucumbers",
|
146
|
+
# tags: {}
|
147
|
+
# )
|
148
|
+
#
|
149
|
+
# # somewhere else, access the active "step" span
|
150
|
+
# step_span = Datadog::CI.active_span("step")
|
151
|
+
# step_span.finish()
|
152
|
+
# ```
|
153
|
+
#
|
154
|
+
# @param [String] span_type type of the span to retrieve (for example "step" or "query") that was provided to {.trace}
|
155
|
+
# @return [Datadog::CI::Span] the active span
|
156
|
+
# @return [nil] if no span is active, or if the active span is not a custom span with given type
|
157
|
+
def active_span(span_type)
|
158
|
+
span = recorder.active_span
|
159
|
+
span if span && span.span_type == span_type
|
160
|
+
end
|
161
|
+
|
162
|
+
# The active, unfinished test span.
|
163
|
+
#
|
164
|
+
# Usage:
|
165
|
+
#
|
166
|
+
# ```
|
167
|
+
# # start a test
|
168
|
+
# Datadog::CI.start_test(
|
169
|
+
# "test_add_two_numbers',
|
170
|
+
# service: "my-web-site-tests",
|
171
|
+
# operation_name: "test",
|
172
|
+
# tags: { Datadog::CI::Ext::Test::TAG_FRAMEWORK => "my-test-framework" }
|
173
|
+
# )
|
174
|
+
#
|
175
|
+
# # somewhere else, access the active test
|
176
|
+
# test_span = Datadog::CI.active_test
|
177
|
+
# test_span.passed!
|
178
|
+
# test_span.finish
|
179
|
+
# ```
|
180
|
+
#
|
181
|
+
# @return [Datadog::CI::Test] the active test
|
182
|
+
# @return [nil] if no test is active
|
183
|
+
def active_test
|
184
|
+
recorder.active_test
|
185
|
+
end
|
186
|
+
|
187
|
+
# Internal only, to finish a test use Datadog::CI::Test#finish
|
188
|
+
def deactivate_test(test)
|
189
|
+
recorder.deactivate_test(test)
|
190
|
+
end
|
191
|
+
|
192
|
+
private
|
193
|
+
|
194
|
+
def components
|
195
|
+
Datadog.send(:components)
|
196
|
+
end
|
197
|
+
|
198
|
+
def recorder
|
199
|
+
components.ci_recorder
|
200
|
+
end
|
201
|
+
end
|
13
202
|
end
|
14
203
|
end
|
15
204
|
|
@@ -2,6 +2,10 @@ module Datadog
|
|
2
2
|
module CI
|
3
3
|
module Configuration
|
4
4
|
module Components : Datadog::Core::Configuration::Components
|
5
|
+
@ci_recorder: Datadog::CI::Recorder
|
6
|
+
|
7
|
+
attr_reader ci_recorder: Datadog::CI::Recorder
|
8
|
+
|
5
9
|
def initialize: (untyped settings) -> void
|
6
10
|
|
7
11
|
def activate_ci!: (untyped settings) -> untyped
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Datadog
|
2
|
+
module CI
|
3
|
+
module Context
|
4
|
+
class Local
|
5
|
+
@key: Symbol
|
6
|
+
|
7
|
+
def initialize: () -> void
|
8
|
+
|
9
|
+
def activate_test!: (Datadog::CI::Test test) ?{ () -> untyped } -> void
|
10
|
+
|
11
|
+
def deactivate_test!: (Datadog::CI::Test test) -> void
|
12
|
+
|
13
|
+
def active_test: () -> Datadog::CI::Test?
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def active_test=: (Datadog::CI::Test? test) -> untyped
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -5,6 +5,7 @@ module Datadog
|
|
5
5
|
module Providers
|
6
6
|
class GithubActions < Extractor
|
7
7
|
@ref: String
|
8
|
+
@github_server_url: String?
|
8
9
|
|
9
10
|
def provider_name: () -> "github"
|
10
11
|
|
@@ -29,6 +30,10 @@ module Datadog
|
|
29
30
|
def git_branch_or_tag: () -> String?
|
30
31
|
|
31
32
|
def ci_env_vars: () -> String?
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def github_server_url: () -> String?
|
32
37
|
end
|
33
38
|
end
|
34
39
|
end
|
data/sig/datadog/ci/recorder.rbs
CHANGED
@@ -1,18 +1,30 @@
|
|
1
1
|
module Datadog
|
2
2
|
module CI
|
3
|
-
|
4
|
-
|
3
|
+
class Recorder
|
4
|
+
@environment_tags: Hash[String, String]
|
5
|
+
@local_context: Datadog::CI::Context::Local
|
5
6
|
|
6
|
-
|
7
|
-
def self.set_tags!: (untyped trace, untyped span, ?::Hash[untyped, untyped] tags) -> untyped
|
7
|
+
attr_reader environment_tags: Hash[String, String]
|
8
8
|
|
9
|
-
def
|
9
|
+
def trace_test: (String span_name, ?service_name: String?, ?operation_name: String, ?tags: Hash[untyped, untyped]) ?{ (Datadog::CI::Test span) -> untyped } -> untyped
|
10
10
|
|
11
|
-
def
|
11
|
+
def trace: (String span_type, String span_name, ?tags: Hash[untyped, untyped]) ?{ (Datadog::CI::Span span) -> untyped } -> untyped
|
12
12
|
|
13
|
-
def
|
13
|
+
def active_test: () -> Datadog::CI::Test?
|
14
14
|
|
15
|
-
def
|
15
|
+
def active_span: () -> Datadog::CI::Span?
|
16
|
+
|
17
|
+
def deactivate_test: (Datadog::CI::Test test) -> void
|
18
|
+
|
19
|
+
def create_datadog_span: (String span_name, ?span_options: Hash[untyped, untyped], ?tags: Hash[untyped, untyped]) ?{ (Datadog::CI::Span span) -> untyped } -> untyped
|
20
|
+
|
21
|
+
def set_trace_origin: (Datadog::Tracing::TraceOperation trace) -> untyped
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def build_test: (Datadog::Tracing::SpanOperation tracer_span, Hash[untyped, untyped] tags) -> Datadog::CI::Test
|
26
|
+
|
27
|
+
def build_span: (Datadog::Tracing::SpanOperation tracer_span, Hash[untyped, untyped] tags) -> Datadog::CI::Span
|
16
28
|
end
|
17
29
|
end
|
18
30
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Datadog
|
2
|
+
module CI
|
3
|
+
class Span
|
4
|
+
@tracer_span: Datadog::Tracing::SpanOperation
|
5
|
+
|
6
|
+
attr_reader tracer_span: Datadog::Tracing::SpanOperation
|
7
|
+
|
8
|
+
def initialize: (Datadog::Tracing::SpanOperation tracer_span) -> void
|
9
|
+
|
10
|
+
def name: () -> String
|
11
|
+
|
12
|
+
def passed!: () -> void
|
13
|
+
|
14
|
+
def failed!: (?exception: untyped?) -> void
|
15
|
+
|
16
|
+
def skipped!: (?exception: untyped?, ?reason: String?) -> void
|
17
|
+
|
18
|
+
def get_tag: (String key) -> untyped?
|
19
|
+
|
20
|
+
def set_tag: (String key, untyped? value) -> void
|
21
|
+
|
22
|
+
def set_metric: (String key, untyped value) -> void
|
23
|
+
|
24
|
+
def set_tags: (Hash[untyped, untyped] tags) -> void
|
25
|
+
|
26
|
+
def finish: () -> void
|
27
|
+
|
28
|
+
def span_type: () -> String
|
29
|
+
|
30
|
+
def set_environment_runtime_tags: () -> void
|
31
|
+
|
32
|
+
def set_default_tags: () -> void
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|