opentelemetry-instrumentation-que 0.5.0 → 0.6.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: b1c00a2cbeefbed1f471d57a3c8064f455f2071372aa4b9214139c34bab86055
4
- data.tar.gz: faafdea99b51729f502c44197e94f181a7958cc19d5b6131c94824f37f2cc1ff
3
+ metadata.gz: 3c1bf2b83d06c852eb0b413c4ee7436c914c9d85eb645e9e41abd14b74979634
4
+ data.tar.gz: a78cdb0937c00ca29015c686de0e1103c21b5336249860b62af63a6548a0e91e
5
5
  SHA512:
6
- metadata.gz: 913508f316cdb100a7aaa0fc989b31c80db02ae5a280686ba4ac13d7efbd9a0b31b76ec8e797cd2f5e7a324dee5dde054b321b5b490c8a5971503e56b697af2f
7
- data.tar.gz: 125d0286409db71f66c68ab8240808865ed07909104779baa8d31bae158abc1e61ec99a94fec92eb5d19572b76b55953d49eba536c555f995d052356b5be4627
6
+ metadata.gz: 98c0e7d9c79363cec480e256bd8a2a6efb2aa7f0121ba9fce25ad27c8b9710479e5c8e532b423a7782f7da377d4ed72dd8fc550896b1bc031cdc27f76a232e2f
7
+ data.tar.gz: 67cc2f7e5d211062e5a1c695ebb241ca362155888626a1261e9119dd113064d2afab64ad4694d96d0f9c663169b75f85dcac2aa78c7f6830b1bd40ffe24b5dea
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Release History: opentelemetry-instrumentation-que
2
2
 
3
+ ### v0.6.0 / 2023-04-17
4
+
5
+ * BREAKING CHANGE: Drop support for EoL Ruby 2.7
6
+
7
+ * ADDED: Drop support for EoL Ruby 2.7
8
+ * FIXED: Drop Rails dependency for ActiveSupport Instrumentation
9
+
10
+ ### v0.5.1 / 2023-01-14
11
+
12
+ * FIXED: Remove `job_options` when using `bulk_enqueue`
13
+ * DOCS: Fix gem homepage
14
+ * DOCS: More gem documentation fixes
15
+
3
16
  ### v0.5.0 / 2022-10-28
4
17
 
5
18
  * ADDED: Add support for `job_options` argument
data/README.md CHANGED
@@ -65,6 +65,28 @@ The `opentelemetry-instrumentation-que` gem source is [on github][repo-github],
65
65
 
66
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].
67
67
 
68
+ ## Testing the gem locally
69
+
70
+ To install test dependencies run:
71
+
72
+ ```
73
+ bundle exec appraisal
74
+ ```
75
+
76
+ To run tests on all appraised Que versions, run:
77
+
78
+ ```
79
+ bundle exec appraisal rake test
80
+ ```
81
+
82
+ To run tests with a specific Que version, run:
83
+
84
+ ```
85
+ bundle exec appraisal [que-version] rake test
86
+ ```
87
+
88
+ All appraised Que versions can be found in the [Appraisals][appraisal-file] file.
89
+
68
90
  ## License
69
91
 
70
92
  The `opentelemetry-instrumentation-que` gem is distributed under the Apache 2.0 license. See [LICENSE][license-github] for more information.
@@ -76,3 +98,4 @@ The `opentelemetry-instrumentation-que` gem is distributed under the Apache 2.0
76
98
  [ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
77
99
  [community-meetings]: https://github.com/open-telemetry/community#community-meetings
78
100
  [discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
101
+ [appraisal-file]: https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/que/Appraisals
@@ -10,7 +10,7 @@ module OpenTelemetry
10
10
  module Middlewares
11
11
  # Server middleware to trace Que jobs
12
12
  class ServerMiddleware
13
- def self.call(job, &block) # rubocop:disable Metrics/MethodLength
13
+ def self.call(job, &block)
14
14
  job_class = job_class(job)
15
15
  span_name = "#{job_class} process"
16
16
  attributes = attributes_before_job_completion(job, job_class)
@@ -74,9 +74,7 @@ module OpenTelemetry
74
74
  # tags is an array looking something like ["tag1", "traceparent:..."]
75
75
  def self.extract_context_from_tags(tags)
76
76
  # Convert tags into Hash (ignoring elements that cannot be converted)
77
- tags_hash = Hash[
78
- tags.map { |value| value.split(':', 2) }.select { |value| value.size == 2 }
79
- ]
77
+ tags_hash = tags.map { |value| value.split(':', 2) }.select { |value| value.size == 2 }.to_h
80
78
  OpenTelemetry.propagation.extract(tags_hash)
81
79
  end
82
80
 
@@ -43,27 +43,39 @@ module OpenTelemetry
43
43
  OpenTelemetry.propagation.inject(tags, setter: TagSetter)
44
44
  end
45
45
 
46
- job_options = job_options.merge(tags: tags)
47
- job = super(*args, job_options: job_options, **arg_opts)
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] = job_options.merge(tags: tags)
50
+ job = super(*args, **arg_opts)
51
+ job_attrs = Thread.current[:que_jobs_to_bulk_insert][:jobs_attrs].last
52
+ else
53
+ job = super(*args, job_options: job_options.merge(tags: tags), **arg_opts)
54
+ job_attrs = job.que_attrs
55
+ end
48
56
 
49
- span.name = "#{job.que_attrs[:job_class]} send"
50
- span.add_attributes(QueJob.job_attributes(job))
57
+ span.name = "#{job_attrs[:job_class]} send"
58
+ span.add_attributes(QueJob.job_attributes(job_attrs))
51
59
 
52
60
  job
53
61
  end
54
62
  end
63
+
64
+ def gem_version
65
+ @gem_version ||= Gem.loaded_specs['que'].version
66
+ end
55
67
  end
56
68
 
57
- def self.job_attributes(job)
69
+ def self.job_attributes(job_attrs)
58
70
  attributes = {
59
71
  'messaging.system' => 'que',
60
72
  'messaging.destination_kind' => 'queue',
61
73
  'messaging.operation' => 'send',
62
- 'messaging.destination' => job.que_attrs[:queue] || 'default',
63
- 'messaging.que.job_class' => job.que_attrs[:job_class],
64
- 'messaging.que.priority' => job.que_attrs[:priority] || 100
74
+ 'messaging.destination' => job_attrs[:queue] || 'default',
75
+ 'messaging.que.job_class' => job_attrs[:job_class],
76
+ 'messaging.que.priority' => job_attrs[:priority] || 100
65
77
  }
66
- attributes['messaging.message_id'] = job.que_attrs[:id] if job.que_attrs[:id]
78
+ attributes['messaging.message_id'] = job_attrs[:id] if job_attrs[:id]
67
79
  attributes
68
80
  end
69
81
  end
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Que
10
- VERSION = '0.5.0'
10
+ VERSION = '0.6.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.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-28 00:00:00.000000000 Z
11
+ date: 2023-04-17 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.21.0
33
+ version: 0.22.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.21.0
40
+ version: 0.22.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activerecord
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.17'
75
+ version: '2.4'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.17'
82
+ version: '2.4'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: minitest
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -126,16 +126,16 @@ dependencies:
126
126
  name: opentelemetry-test-helpers
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
131
+ version: '0.3'
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: '0'
138
+ version: '0.3'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: pg
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: 1.3.0
187
+ version: 1.48.1
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: 1.3.0
194
+ version: 1.48.1
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: simplecov
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -254,14 +254,14 @@ files:
254
254
  - lib/opentelemetry/instrumentation/que/patches/que_job.rb
255
255
  - lib/opentelemetry/instrumentation/que/tag_setter.rb
256
256
  - lib/opentelemetry/instrumentation/que/version.rb
257
- homepage: https://github.com/open-telemetry/opentelemetry-contrib
257
+ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
258
258
  licenses:
259
259
  - Apache-2.0
260
260
  metadata:
261
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby-contrib/opentelemetry-instrumentation-que/v0.5.0/file.CHANGELOG.html
261
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-que/0.6.0/file/CHANGELOG.md
262
262
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/que
263
263
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
264
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby-contrib/opentelemetry-instrumentation-que/v0.5.0
264
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-que/0.6.0
265
265
  post_install_message:
266
266
  rdoc_options: []
267
267
  require_paths:
@@ -270,14 +270,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
270
270
  requirements:
271
271
  - - ">="
272
272
  - !ruby/object:Gem::Version
273
- version: 2.6.0
273
+ version: '3.0'
274
274
  required_rubygems_version: !ruby/object:Gem::Requirement
275
275
  requirements:
276
276
  - - ">="
277
277
  - !ruby/object:Gem::Version
278
278
  version: '0'
279
279
  requirements: []
280
- rubygems_version: 3.1.6
280
+ rubygems_version: 3.2.33
281
281
  signing_key:
282
282
  specification_version: 4
283
283
  summary: Que instrumentation for the OpenTelemetry framework