opentelemetry-instrumentation-que 0.8.3 → 0.9.0

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: f62be1233566b3fcdf175addec14f0306f87b2341bed9eec01945ada2a897317
4
+ data.tar.gz: aa7350c7a72b0bb53ae26109f0231241a8d5cdea4f2c46e49dd6ac2947210873
5
5
  SHA512:
6
- metadata.gz: f98a22743c5cf95a3b65decbf567d123d0783a3e067549dcb26974611126fd40f688c6548ccf3f7245e4fc4d61020ad9a8b0a6922b4a8508f65c548545490d4f
7
- data.tar.gz: 465564fd061d8149dc7ea772f9b5386d38ed5738f82538e2e7d66eaa43a8d9542c80ce9ebc57025783496cc34cc2352bfc716cf26a5b73c032da98a056cc6505
6
+ metadata.gz: 752990242accf0414cac4d28e022a40cff813de93871b0e07e91496df4247280332f70cd03012962cb3c4e4cf28024b3d5b48f27342b4e9e5c84b6dc08f501ba
7
+ data.tar.gz: 5c30205da23fba93401b6f0084aac40020f693e5664e255f92ea9ec30b490eed5272c684c64c04ee26195906ff727fde882e32bb0e8f331b42690fda932e1bf9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Release History: opentelemetry-instrumentation-que
2
2
 
3
+ ### v0.9.0 / 2025-01-16
4
+
5
+ * BREAKING CHANGE: Drop Support for EoL Rails 6.1
6
+ * BREAKING CHANGE: Set minimum supported version to Ruby 3.1
7
+
8
+ * ADDED: Drop Support for EoL Rails 6.1
9
+ * ADDED: Set minimum supported version to Ruby 3.1
10
+
11
+ ### v0.8.4 / 2024-10-08
12
+
13
+ * FIXED: Fix bulk_enqueue when enqueuing more than 5 jobs
14
+
3
15
  ### v0.8.3 / 2024-07-23
4
16
 
5
17
  * 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.9.0'
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.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-24 00:00:00.000000000 Z
11
+ date: 2025-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.22.1
33
+ version: 0.23.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.22.1
40
+ version: 0.23.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: appraisal
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -128,28 +128,28 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.65.0
131
+ version: 1.69.1
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.69.1
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.23.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.23.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: simplecov
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -202,11 +202,11 @@ 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.9.0/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
209
- post_install_message:
208
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-que/0.9.0
209
+ post_install_message:
210
210
  rdoc_options: []
211
211
  require_paths:
212
212
  - lib
@@ -214,15 +214,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
214
214
  requirements:
215
215
  - - ">="
216
216
  - !ruby/object:Gem::Version
217
- version: '3.0'
217
+ version: '3.1'
218
218
  required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - ">="
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0'
223
223
  requirements: []
224
- rubygems_version: 3.2.33
225
- signing_key:
224
+ rubygems_version: 3.3.27
225
+ signing_key:
226
226
  specification_version: 4
227
227
  summary: Que instrumentation for the OpenTelemetry framework
228
228
  test_files: []