opentelemetry-instrumentation-que 0.8.3 → 0.8.4

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: 540fe598d76b48500dee1e87d08fea0893669f5f4ff129f963638fe40eaf0c0f
4
- data.tar.gz: 92756ec6a1b077eddb1adf8346d23b968419ba85a3354417cd307a246b5f51d3
3
+ metadata.gz: d086b86cf7e9b0ff32ad2b29bceb0de4ff488de6d656a744474f192f9bbe58c4
4
+ data.tar.gz: 0b393f71c91b59c6315d5f31070b8340ad2d91de23c7bdadd86e304937a42a78
5
5
  SHA512:
6
- metadata.gz: f98a22743c5cf95a3b65decbf567d123d0783a3e067549dcb26974611126fd40f688c6548ccf3f7245e4fc4d61020ad9a8b0a6922b4a8508f65c548545490d4f
7
- data.tar.gz: 465564fd061d8149dc7ea772f9b5386d38ed5738f82538e2e7d66eaa43a8d9542c80ce9ebc57025783496cc34cc2352bfc716cf26a5b73c032da98a056cc6505
6
+ metadata.gz: 2411caa844782fddce419ab227f2aa56be8db3a82d267bae8a24892ac97cdb367cdbb3e4c265d6219e640c929979bbe13984f31bcd5632752ddaa98c0a87d27b
7
+ data.tar.gz: 73d2fde3b9d7cfff4d76a1a930679af47abf2b3a957fcf649d242380d80cc6c749ed1c757240194cd3968a2138d5d45f16513a88e3493c914cfba8594e88e569
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release History: opentelemetry-instrumentation-que
2
2
 
3
+ ### v0.8.4 / 2024-10-08
4
+
5
+ * FIXED: Fix bulk_enqueue when enqueuing more than 5 jobs
6
+
3
7
  ### v0.8.3 / 2024-07-23
4
8
 
5
9
  * DOCS: Add cspell to CI
data/README.md CHANGED
@@ -6,7 +6,7 @@ The Que instrumentation is a community-maintained instrumentation for the [Que][
6
6
 
7
7
  Install the gem using:
8
8
 
9
- ```
9
+ ```console
10
10
  gem install opentelemetry-instrumentation-que
11
11
  ```
12
12
 
@@ -63,25 +63,25 @@ end
63
63
 
64
64
  The `opentelemetry-instrumentation-que` gem source is [on github][repo-github], along with related gems including `opentelemetry-api` and `opentelemetry-sdk`.
65
65
 
66
- The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us in [GitHub Discussions][discussions-url] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
66
+ The OpenTelemetry Ruby gems are maintained by the OpenTelemetry Ruby special interest group (SIG). You can get involved by joining us on our [GitHub Discussions][discussions-url], [Slack Channel][slack-channel] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
67
67
 
68
68
  ## Testing the gem locally
69
69
 
70
70
  To install test dependencies run:
71
71
 
72
- ```
72
+ ```console
73
73
  bundle exec appraisal
74
74
  ```
75
75
 
76
76
  To run tests on all appraised Que versions, run:
77
77
 
78
- ```
78
+ ```console
79
79
  bundle exec appraisal rake test
80
80
  ```
81
81
 
82
82
  To run tests with a specific Que version, run:
83
83
 
84
- ```
84
+ ```console
85
85
  bundle exec appraisal [que-version] rake test
86
86
  ```
87
87
 
@@ -97,5 +97,6 @@ The `opentelemetry-instrumentation-que` gem is distributed under the Apache 2.0
97
97
  [license-github]: https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/LICENSE
98
98
  [ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
99
99
  [community-meetings]: https://github.com/open-telemetry/community#community-meetings
100
+ [slack-channel]: https://cloud-native.slack.com/archives/C01NWKKMKMY
100
101
  [discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
101
102
  [appraisal-file]: https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/que/Appraisals
@@ -19,6 +19,10 @@ module OpenTelemetry
19
19
  # Module to prepend to Que singleton class
20
20
  module ClassMethods
21
21
  def enqueue(*args, job_options: {}, **arg_opts)
22
+ # In Que version 2.1.0 `bulk_enqueue` was introduced.
23
+ # In that case, the span is created inside the `bulk_enqueue` method.
24
+ return super(*args, **arg_opts) if gem_version >= Gem::Version.new('2.1.0') && Thread.current[:que_jobs_to_bulk_insert]
25
+
22
26
  tracer = Que::Instrumentation.instance.tracer
23
27
  otel_config = Que::Instrumentation.instance.config
24
28
 
@@ -43,19 +47,8 @@ module OpenTelemetry
43
47
  OpenTelemetry.propagation.inject(tags, setter: TagSetter)
44
48
  end
45
49
 
46
- # In Que version 2.1.0 `bulk_enqueue` was introduced and in order
47
- # for it to work, we must pass `job_options` to `bulk_enqueue` instead of enqueue.
48
- if gem_version >= Gem::Version.new('2.1.0') && Thread.current[:que_jobs_to_bulk_insert]
49
- Thread.current[:que_jobs_to_bulk_insert][:job_options] = Thread.current[:que_jobs_to_bulk_insert][:job_options]&.merge(tags: tags) do |_, a, b|
50
- a.is_a?(Array) && b.is_a?(Array) ? a.concat(b) : b
51
- end
52
-
53
- job = super(*args, **arg_opts)
54
- job_attrs = Thread.current[:que_jobs_to_bulk_insert][:jobs_attrs].last
55
- else
56
- job = super(*args, job_options: job_options.merge(tags: tags), **arg_opts)
57
- job_attrs = job.que_attrs
58
- end
50
+ job = super(*args, job_options: job_options.merge(tags: tags), **arg_opts)
51
+ job_attrs = job.que_attrs
59
52
 
60
53
  span.name = "#{job_attrs[:job_class]} publish"
61
54
  span.add_attributes(QueJob.job_attributes(job_attrs))
@@ -67,6 +60,32 @@ module OpenTelemetry
67
60
  def gem_version
68
61
  @gem_version ||= Gem.loaded_specs['que'].version
69
62
  end
63
+
64
+ if Gem.loaded_specs['que'].version >= Gem::Version.new('2.1.0')
65
+ def bulk_enqueue(**_kwargs, &block)
66
+ tracer = Que::Instrumentation.instance.tracer
67
+ otel_config = Que::Instrumentation.instance.config
68
+
69
+ tracer.in_span('publish', kind: :producer) do |span|
70
+ super do
71
+ yield
72
+
73
+ job_attrs = Thread.current[:que_jobs_to_bulk_insert][:jobs_attrs]
74
+
75
+ unless job_attrs.empty?
76
+ span.name = "#{job_attrs.first[:job_class]} publish"
77
+ span.add_attributes(QueJob.job_attributes(job_attrs.first))
78
+ end
79
+
80
+ if otel_config[:propagation_style] != :none
81
+ job_options = Thread.current[:que_jobs_to_bulk_insert][:job_options]
82
+ job_options[:tags] ||= []
83
+ OpenTelemetry.propagation.inject(job_options[:tags], setter: TagSetter)
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
70
89
  end
71
90
 
72
91
  def self.job_attributes(job_attrs)
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Que
10
- VERSION = '0.8.3'
10
+ VERSION = '0.8.4'
11
11
  end
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-instrumentation-que
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-24 00:00:00.000000000 Z
11
+ date: 2024-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -128,28 +128,28 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.65.0
131
+ version: 1.66.0
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 1.65.0
138
+ version: 1.66.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rubocop-performance
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '1.20'
145
+ version: 1.22.0
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '1.20'
152
+ version: 1.22.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: simplecov
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -202,10 +202,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
202
202
  licenses:
203
203
  - Apache-2.0
204
204
  metadata:
205
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-que/0.8.3/file/CHANGELOG.md
205
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-que/0.8.4/file/CHANGELOG.md
206
206
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/que
207
207
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
208
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-que/0.8.3
208
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-que/0.8.4
209
209
  post_install_message:
210
210
  rdoc_options: []
211
211
  require_paths: