buildkite-test_collector 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/buildkite/test_collector/ci.rb +1 -0
- data/lib/buildkite/test_collector/library_hooks/rspec.rb +3 -1
- data/lib/buildkite/test_collector/minitest_plugin.rb +5 -1
- data/lib/buildkite/test_collector/tracer.rb +17 -3
- data/lib/buildkite/test_collector/version.rb +1 -1
- data/lib/buildkite/test_collector.rb +7 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e8ff4ceff4d825291a8878bf19a912362d45c36d6750c5e14628f446cec0bbd
|
4
|
+
data.tar.gz: 215441296a3c91547b0c43b062893239fbe5bae5ca2e1a80cca7b2ec65277e77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d31e59e76f2dc92ef5951f9d97663f14cb84d9ba1256c8586931146151222c7ce3769a8913517910312d0a75a7cafb3488f0b9690257c4fc6686fbf37cbed9ee
|
7
|
+
data.tar.gz: 995fc9e592b74a41385058c4eac868e9639f6ef9bfb2ba9068cd156fd6ab5d90bf40aca86a9ab9c8560cf7c9ba80c4f172747a948e4e219976c680d035eae0af
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -40,6 +40,7 @@ class Buildkite::TestCollector::CI
|
|
40
40
|
"language_version" => RUBY_VERSION,
|
41
41
|
"version" => Buildkite::TestCollector::VERSION,
|
42
42
|
"collector" => "ruby-#{Buildkite::TestCollector::NAME}",
|
43
|
+
"trace_min_duration" => Buildkite::TestCollector.trace_min_duration&.to_s,
|
43
44
|
}.select { |_, value| !value.nil? }
|
44
45
|
end
|
45
46
|
|
@@ -16,7 +16,9 @@ RSpec.configure do |config|
|
|
16
16
|
end
|
17
17
|
|
18
18
|
config.around(:each) do |example|
|
19
|
-
tracer = Buildkite::TestCollector::Tracer.new
|
19
|
+
tracer = Buildkite::TestCollector::Tracer.new(
|
20
|
+
min_duration: Buildkite::TestCollector.trace_min_duration,
|
21
|
+
)
|
20
22
|
|
21
23
|
# The _buildkite prefix here is added as a safeguard against name collisions
|
22
24
|
# as we are in the main thread
|
@@ -9,7 +9,11 @@ require_relative "minitest_plugin/trace"
|
|
9
9
|
module Buildkite::TestCollector::MinitestPlugin
|
10
10
|
def before_setup
|
11
11
|
super
|
12
|
-
|
12
|
+
|
13
|
+
tracer = Buildkite::TestCollector::Tracer.new(
|
14
|
+
min_duration: Buildkite::TestCollector.trace_min_duration,
|
15
|
+
)
|
16
|
+
|
13
17
|
# The _buildkite prefix here is added as a safeguard against name collisions
|
14
18
|
# as we are in the main thread
|
15
19
|
Thread.current[:_buildkite_tracer] = tracer
|
@@ -35,21 +35,30 @@ module Buildkite::TestCollector
|
|
35
35
|
@children = []
|
36
36
|
end
|
37
37
|
|
38
|
+
def duration
|
39
|
+
raise IncompleteSpan if end_at.nil?
|
40
|
+
|
41
|
+
end_at - start_at
|
42
|
+
end
|
43
|
+
|
38
44
|
def as_hash
|
39
45
|
{
|
40
46
|
section: section,
|
41
47
|
start_at: start_at,
|
42
48
|
end_at: end_at,
|
43
|
-
duration:
|
49
|
+
duration: duration,
|
44
50
|
detail: detail,
|
45
51
|
children: children.map(&:as_hash),
|
46
52
|
}
|
47
53
|
end
|
54
|
+
|
55
|
+
class IncompleteSpan < StandardError; end
|
48
56
|
end
|
49
57
|
|
50
|
-
def initialize
|
58
|
+
def initialize(min_duration: nil)
|
51
59
|
@top = Span.new(:top, MonotonicTime.call, nil, {})
|
52
60
|
@stack = [@top]
|
61
|
+
@min_duration = min_duration
|
53
62
|
end
|
54
63
|
|
55
64
|
def enter(section, **detail)
|
@@ -60,11 +69,16 @@ module Buildkite::TestCollector
|
|
60
69
|
|
61
70
|
def leave
|
62
71
|
current_span.end_at = MonotonicTime.call
|
72
|
+
duration = current_span.duration
|
63
73
|
@stack.pop
|
74
|
+
current_span.children.pop if @min_duration && duration < @min_duration
|
75
|
+
nil # avoid ambiguous return type/value
|
64
76
|
end
|
65
77
|
|
66
78
|
def backfill(section, duration, **detail)
|
67
|
-
|
79
|
+
return if @min_duration && duration < @min_duration
|
80
|
+
now = MonotonicTime.call
|
81
|
+
new_entry = Span.new(section, now - duration, now, detail)
|
68
82
|
current_span.children << new_entry
|
69
83
|
end
|
70
84
|
|
@@ -38,6 +38,7 @@ module Buildkite
|
|
38
38
|
attr_accessor :artifact_path
|
39
39
|
attr_accessor :env
|
40
40
|
attr_accessor :batch_size
|
41
|
+
attr_accessor :trace_min_duration
|
41
42
|
end
|
42
43
|
|
43
44
|
def self.configure(hook:, token: nil, url: nil, tracing_enabled: true, artifact_path: nil, env: {})
|
@@ -47,6 +48,12 @@ module Buildkite
|
|
47
48
|
self.artifact_path = artifact_path
|
48
49
|
self.env = env
|
49
50
|
self.batch_size = ENV.fetch("BUILDKITE_ANALYTICS_UPLOAD_BATCH_SIZE") { DEFAULT_UPLOAD_BATCH_SIZE }.to_i
|
51
|
+
|
52
|
+
trace_min_ms_string = ENV["BUILDKITE_ANALYTICS_TRACE_MIN_MS"]
|
53
|
+
self.trace_min_duration = if trace_min_ms_string && !trace_min_ms_string.empty?
|
54
|
+
Float(trace_min_ms_string) / 1000
|
55
|
+
end
|
56
|
+
|
50
57
|
self.hook_into(hook)
|
51
58
|
end
|
52
59
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buildkite-test_collector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Buildkite
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.10'
|
55
|
-
description:
|
55
|
+
description:
|
56
56
|
email:
|
57
57
|
- support+analytics@buildkite.com
|
58
58
|
executables: []
|
@@ -100,7 +100,7 @@ licenses:
|
|
100
100
|
metadata:
|
101
101
|
homepage_uri: https://github.com/buildkite/test-collector-ruby
|
102
102
|
source_code_uri: https://github.com/buildkite/test-collector-ruby
|
103
|
-
post_install_message:
|
103
|
+
post_install_message:
|
104
104
|
rdoc_options: []
|
105
105
|
require_paths:
|
106
106
|
- lib
|
@@ -115,8 +115,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
requirements: []
|
118
|
-
rubygems_version: 3.
|
119
|
-
signing_key:
|
118
|
+
rubygems_version: 3.4.10
|
119
|
+
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Track test executions and report to Buildkite Test Analytics
|
122
122
|
test_files: []
|