opentelemetry-instrumentation-que 0.5.0 → 0.5.1

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: 8c38bc717ae44997443d4fa9013147f40f9003cac7006fb7971660d8ff5f451d
4
+ data.tar.gz: d2343c6ff9279e7f1929cf3e7c1cc0a6998a97474745ddc5efb77676ff73c07e
5
5
  SHA512:
6
- metadata.gz: 913508f316cdb100a7aaa0fc989b31c80db02ae5a280686ba4ac13d7efbd9a0b31b76ec8e797cd2f5e7a324dee5dde054b321b5b490c8a5971503e56b697af2f
7
- data.tar.gz: 125d0286409db71f66c68ab8240808865ed07909104779baa8d31bae158abc1e61ec99a94fec92eb5d19572b76b55953d49eba536c555f995d052356b5be4627
6
+ metadata.gz: 2217e4afe351dd0acf6437bbe21e0d2fd0583f4b74f90e38fc0c9e1582a45443dadd98b57ad73ab05a4742bf2c46f94635b13abf131194fff2e4196e60ae82c4
7
+ data.tar.gz: 36d591016e58c7d7973b5f1c206e85962914134198a857e55873c27756086ff093ec73748187f4fbd8f012ba7de00af3f1a8d79d425e3af6465041ef5cc0536e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History: opentelemetry-instrumentation-que
2
2
 
3
+ ### v0.5.1 / 2023-01-14
4
+
5
+ * FIXED: Remove `job_options` when using `bulk_enqueue`
6
+ * DOCS: Fix gem homepage
7
+ * DOCS: More gem documentation fixes
8
+
3
9
  ### v0.5.0 / 2022-10-28
4
10
 
5
11
  * 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
@@ -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.5.1'
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.5.1
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-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -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
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: 1.3.0
187
+ version: 1.41.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.41.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.5.1/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.5.1
265
265
  post_install_message:
266
266
  rdoc_options: []
267
267
  require_paths: