rspec-otel 0.0.6 → 0.0.7
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/lib/rspec_otel/matchers/emit_span.rb +15 -9
- data/lib/rspec_otel/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b966349d533ad57a8ee5fc1fd79b7ed99922beb6aad8fc1fb59e97d8062cdf5e
|
|
4
|
+
data.tar.gz: e167fba956f24f180846574e5b87214f906b0d35377d7b92230df99aa6244dc2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5f19d4e4b8c94818c8d11e373380fc527c8e61f875e24189c3fa401a38d49f1647eb4f5e4862dea702de3397fd2ec81ee6deca4612056678c8de9faa90208eae
|
|
7
|
+
data.tar.gz: a3320a67e728db92483d66a7cad492abbc7785cb7088417ab8e9e23b1648db348b0b32e869b308d6369a0cb7c267c613a17e7f0f810d11ab5138a4cbb6072b98
|
|
@@ -9,18 +9,23 @@ module RspecOtel
|
|
|
9
9
|
@name = name
|
|
10
10
|
@filters = []
|
|
11
11
|
@before_spans = []
|
|
12
|
+
@closest_span = nil
|
|
12
13
|
|
|
13
14
|
@filters << name_filter
|
|
14
15
|
end
|
|
15
16
|
|
|
16
|
-
def matches?(block)
|
|
17
|
+
def matches?(block) # rubocop:disable Metrics/MethodLength
|
|
17
18
|
if block.respond_to?(:call)
|
|
18
19
|
@before_spans = RspecOtel.exporter.finished_spans
|
|
19
20
|
block.call
|
|
20
21
|
end
|
|
21
22
|
|
|
23
|
+
closest_count = 0
|
|
22
24
|
(RspecOtel.exporter.finished_spans - @before_spans).each do |span|
|
|
23
|
-
|
|
25
|
+
count = @filters.count { |f| f.call(span) }
|
|
26
|
+
@closest_span = span if count > closest_count
|
|
27
|
+
closest_count = count
|
|
28
|
+
return true if count == @filters.count
|
|
24
29
|
end
|
|
25
30
|
|
|
26
31
|
false
|
|
@@ -134,12 +139,9 @@ module RspecOtel
|
|
|
134
139
|
private
|
|
135
140
|
|
|
136
141
|
def closest_span
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
end.first
|
|
141
|
-
span = all_spans.first if span.nil?
|
|
142
|
-
span
|
|
142
|
+
return @closest_span unless @closest_span.nil?
|
|
143
|
+
|
|
144
|
+
(RspecOtel.exporter.finished_spans - @before_spans).first
|
|
143
145
|
end
|
|
144
146
|
|
|
145
147
|
def failure_match_description
|
|
@@ -173,9 +175,13 @@ module RspecOtel
|
|
|
173
175
|
|
|
174
176
|
def exception_attributes(exception)
|
|
175
177
|
attributes = {}
|
|
176
|
-
|
|
178
|
+
return attributes if exception.nil?
|
|
179
|
+
|
|
180
|
+
if exception.is_a?(Exception)
|
|
177
181
|
attributes['exception.type'] = exception.class.to_s
|
|
178
182
|
attributes['exception.message'] = exception.message
|
|
183
|
+
else
|
|
184
|
+
attributes['exception.type'] = exception.to_s
|
|
179
185
|
end
|
|
180
186
|
|
|
181
187
|
attributes
|
data/lib/rspec_otel/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec-otel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Damien MATHIEU
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: opentelemetry-api
|
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
98
98
|
- !ruby/object:Gem::Version
|
|
99
99
|
version: '0'
|
|
100
100
|
requirements: []
|
|
101
|
-
rubygems_version: 3.6.
|
|
101
|
+
rubygems_version: 3.6.9
|
|
102
102
|
specification_version: 4
|
|
103
103
|
summary: RSpec matchers for the OpenTelemetry framework
|
|
104
104
|
test_files: []
|