codecov_opentelem 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 605e855408e313442cbad82cc91a2196ac78c00b28b31392ebb29866b5b9e905
4
- data.tar.gz: bd615050396e4f6f5b49672bb18db56c61e6da2dd7615d067177f955b2ed5d8a
3
+ metadata.gz: d385d9be5936bef168660940493430288123e80e7e52ef7cfe3c745d7426dc71
4
+ data.tar.gz: ee1593d6f7e9b04d964f81d290a6116ea6d460ad65352500cc3b8b0d8c9b813d
5
5
  SHA512:
6
- metadata.gz: 291d786144b93336b21540737ea4cf0983ec28eb2d03f507566d857ef8784d0a2cc7d7aaa8938473f7a15e5b16866a93761e5f81b43ad1dddf7665e9fdee9270
7
- data.tar.gz: a1d7580bc43a5fa05246ac2920fe5ab03c4f8dad3f0ba6b1d51f670ac99ddda3639699627f27c7954eac7d65658f2a5f30c45ac2896aee22390ccc5c1c7b25ed
6
+ metadata.gz: 970d7e5aeecdea1689d933bfa78c222b70265345f3c62b62c79220b6ff212832146a41bcff5cc1017987b572c46d49c8a934cf883d3841630056400e1df5796a
7
+ data.tar.gz: 02fbe4c9bbc6c9e36f346d139dd6c0ea5f82fc4216d75a307a31d79a64ea146775ea06eb8f05d88eff076087f4959b60d97525b744867efb5bf12330dae1017c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- codecov_opentelem (0.1.3)
4
+ codecov_opentelem (0.1.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -14,23 +14,22 @@ end
14
14
 
15
15
  class CodecovCoverageStorageManager
16
16
  def initialize(filters)
17
- Coverage.start
18
17
  @filters = filters
19
18
  @inner = {}
20
19
  end
21
20
 
22
21
  def start_coverage_for_span(span)
23
22
  if !@filters[CoverageSpanFilter::REGEX_NAME].nil? && @filters[CoverageSpanFilter::REGEX_NAME].match(span.name)
23
+ puts 'returned false'
24
24
  return false
25
25
  end
26
26
 
27
- Coverage.resume unless Coverage.running?
27
+ Coverage.start unless Coverage.running?
28
28
  true
29
29
  end
30
30
 
31
31
  def stop_coverage_for_span(span)
32
- span_id = span.span_id
33
- Coverage.suspend
32
+ span_id = span.context.span_id
34
33
  @inner[span_id] = Coverage.result(stop: false, clear: true)
35
34
  end
36
35
 
@@ -48,10 +47,10 @@ class CodecovCoverageGenerator < OpenTelemetry::SDK::Trace::SpanProcessor
48
47
  end
49
48
 
50
49
  def on_start(span, _parent_context = nil)
51
- @cov_storage.start_coverage_for_span(span) if rand < @sample_rate
50
+ @cov_storage.start_coverage_for_span(span) if rand() < @sample_rate
52
51
  end
53
52
 
54
- def on_end(span)
53
+ def on_finish(span)
55
54
  @cov_storage.stop_coverage_for_span(span)
56
55
  end
57
56
  end
@@ -69,6 +68,7 @@ class CoverageExporter < OpenTelemetry::SDK::Trace::Export::SpanExporter
69
68
  def export(spans, timeout)
70
69
  tracked_spans = []
71
70
  untracked_spans = []
71
+
72
72
  spans.each do |span|
73
73
  cov = @cov_storage.pop_coverage_for_span(span)
74
74
 
@@ -77,15 +77,18 @@ class CoverageExporter < OpenTelemetry::SDK::Trace::Export::SpanExporter
77
77
  v = v.dup.force_encoding("ISO-8859-1").encode("UTF-8") if v.is_a? String
78
78
  span_hash[k] = v
79
79
  end
80
- s = span_hash.to_json
81
80
 
82
81
  if !cov.nil?
83
- s['codecov'] = { 'type' => 'bytes', 'coverage' => cov }
84
- tracked_spans.append(s)
85
- elsif rand < @untracked_export_rate
86
- untracked_spans.append(s)
82
+ span_hash['codecov'] = {
83
+ 'coverage': cov.to_json,
84
+ 'type': 'json',
85
+ }
86
+ tracked_spans.append(span_hash.to_json)
87
+ elsif rand() < @untracked_export_rate
88
+ untracked_spans.append(span_hash.to_json)
87
89
  end
88
90
  end
91
+
89
92
  return OpenTelemetry::SDK::Trace::Export::SUCCESS if !tracked_spans && !untracked_spans
90
93
 
91
94
  body = { 'profiling' => @code }.to_json
@@ -110,7 +113,7 @@ class CoverageExporter < OpenTelemetry::SDK::Trace::Export::SpanExporter
110
113
  req.body = {
111
114
  'spans' => tracked_spans,
112
115
  'untracked' => untracked_spans
113
- }.to_json,
116
+ }.to_json
114
117
  https.request(req)
115
118
  OpenTelemetry::SDK::Trace::Export::SUCCESS
116
119
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CodecovOpentelem
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codecov_opentelem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ahmed-Elghrbawy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-17 00:00:00.000000000 Z
11
+ date: 2022-06-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: