opentelemetry-instrumentation-ruby_kafka 0.20.1 → 0.21.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: 4b7a6f767f7bc01631fb7c795420b641fe40a45985a37ffe02cf6f6bbe7e186c
4
- data.tar.gz: ae102bd72261240ca875f18a824bf0d35180aa65d444c6c416fe4e9f1f926fd1
3
+ metadata.gz: 304cebb35fa179634d1ea9f3baf2559021ed69bdae1d2a1348dd4511b5df1260
4
+ data.tar.gz: c0273721ce9c27a4c9ce55e1d7d9647b743f85b9e141755f7001ee5258dc36ea
5
5
  SHA512:
6
- metadata.gz: 12f07057792fad0e23b53e50259fca79aa36571b191ea2418f89d92704cb233d256bffa43c98a793c4bc2eec8d4ed1810ec7ae1deae3a66fa08d4df49d72a53c
7
- data.tar.gz: f52ce0dadc1acfc3062f723379fae88dd9bde6fe2ccff6113f59b5c45831709bd5503ffb25399ce82484c976b877e8cc38819e1e8d59c5c67062762a7f9a9f91
6
+ metadata.gz: 53a19b2190a50b3ad22c4817af0867e5808d604c862f85e5ff0381de148d8282f64df5c65aee3c9e0ed70465caddd19498defb12a5a47d33266ad9b996ea0e66
7
+ data.tar.gz: 58f1e0e7e7131c87f9ec663d2c9b48192e4e98c106e7c2159ab2228aa61252489097e513509ea1add7f8f1204c846966c45dc7f25d843fed07462b7574f1ca27
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Release History: opentelemetry-instrumentation-ruby_kafka
2
2
 
3
+ ### v0.21.0 / 2023-09-07
4
+
5
+ * FIXED: Align messaging instrumentation operation names
6
+
7
+ ### v0.20.2 / 2023-08-09
8
+
9
+ * FIXED: propagate context from async producer
10
+
3
11
  ### v0.20.1 / 2023-06-05
4
12
 
5
13
  * FIXED: Base config options
@@ -32,12 +32,14 @@ module OpenTelemetry
32
32
  end
33
33
 
34
34
  def require_patches
35
+ require_relative 'patches/async_producer'
35
36
  require_relative 'patches/producer'
36
37
  require_relative 'patches/consumer'
37
38
  require_relative 'patches/client'
38
39
  end
39
40
 
40
41
  def patch
42
+ ::Kafka::AsyncProducer.prepend(Patches::AsyncProducer)
41
43
  ::Kafka::Producer.prepend(Patches::Producer)
42
44
  ::Kafka::Consumer.prepend(Patches::Consumer)
43
45
  ::Kafka::Client.prepend(Patches::Client)
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenTelemetry
4
+ module Instrumentation
5
+ module RubyKafka
6
+ module Patches
7
+ # The AsyncProducer module contains the instrumentation patch the AsyncProducer#produce method
8
+ module AsyncProducer
9
+ def produce(value, topic:, **options)
10
+ options = __otel_merge_options!(**options)
11
+ super
12
+ end
13
+
14
+ def __otel_merge_options!(**options)
15
+ options ||= { headers: {} }
16
+ # The propagator mutates the carrier (first positional argument), so we need to set headers to empty hash so
17
+ # that there's something to mutate
18
+ options[:headers] = {} unless options[:headers]
19
+ OpenTelemetry.propagation.inject(options[:headers])
20
+ options
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -24,7 +24,7 @@ module OpenTelemetry
24
24
 
25
25
  attributes['messaging.kafka.partition'] = partition if partition
26
26
 
27
- tracer.in_span("#{topic} send", attributes: attributes, kind: :producer) do
27
+ tracer.in_span("#{topic} publish", attributes: attributes, kind: :producer) do
28
28
  OpenTelemetry.propagation.inject(headers)
29
29
  super
30
30
  end
@@ -17,9 +17,15 @@ module OpenTelemetry
17
17
  'messaging.destination_kind' => 'topic'
18
18
  }
19
19
 
20
- tracer.in_span("#{topic} send", attributes: attributes, kind: :producer) do
21
- OpenTelemetry.propagation.inject(headers)
22
- super
20
+ # If trace context is present in headers, extract and use it as parent. If there is _no_ trace context key
21
+ # in the headers, OpenTelemetry.propagation.extract will return an unmodified copy of the the current
22
+ # Thread's context, so the next two lines preserve the correct Thread-local context.
23
+ ctx = OpenTelemetry.propagation.extract(headers)
24
+ OpenTelemetry::Context.with_current(ctx) do
25
+ tracer.in_span("#{topic} publish", attributes: attributes, kind: :producer) do
26
+ OpenTelemetry.propagation.inject(headers)
27
+ super
28
+ end
23
29
  end
24
30
  end
25
31
 
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module RubyKafka
10
- VERSION = '0.20.1'
10
+ VERSION = '0.21.0'
11
11
  end
12
12
  end
13
13
  end
@@ -15,5 +15,5 @@ module OpenTelemetry
15
15
  end
16
16
  end
17
17
 
18
- require_relative './ruby_kafka/instrumentation'
19
- require_relative './ruby_kafka/version'
18
+ require_relative 'ruby_kafka/instrumentation'
19
+ require_relative 'ruby_kafka/version'
@@ -16,4 +16,4 @@ module OpenTelemetry
16
16
  end
17
17
  end
18
18
 
19
- require_relative './instrumentation/ruby_kafka'
19
+ require_relative 'instrumentation/ruby_kafka'
@@ -4,4 +4,4 @@
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
7
- require_relative './opentelemetry/instrumentation'
7
+ require_relative 'opentelemetry/instrumentation'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-instrumentation-ruby_kafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.1
4
+ version: 0.21.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: 2023-06-05 00:00:00.000000000 Z
11
+ date: 2023-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.2.0
47
+ version: '2.5'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.2.0
54
+ version: '2.5'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.50.2
131
+ version: 1.56.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.50.2
138
+ version: 1.56.1
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: ruby-kafka
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -178,20 +178,6 @@ dependencies:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0.9'
181
- - !ruby/object:Gem::Dependency
182
- name: yard-doctest
183
- requirement: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - "~>"
186
- - !ruby/object:Gem::Version
187
- version: 0.1.6
188
- type: :development
189
- prerelease: false
190
- version_requirements: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - "~>"
193
- - !ruby/object:Gem::Version
194
- version: 0.1.6
195
181
  description: RubyKafka instrumentation for the OpenTelemetry framework
196
182
  email:
197
183
  - cncf-opentelemetry-contributors@lists.cncf.io
@@ -207,6 +193,7 @@ files:
207
193
  - lib/opentelemetry/instrumentation.rb
208
194
  - lib/opentelemetry/instrumentation/ruby_kafka.rb
209
195
  - lib/opentelemetry/instrumentation/ruby_kafka/instrumentation.rb
196
+ - lib/opentelemetry/instrumentation/ruby_kafka/patches/async_producer.rb
210
197
  - lib/opentelemetry/instrumentation/ruby_kafka/patches/client.rb
211
198
  - lib/opentelemetry/instrumentation/ruby_kafka/patches/consumer.rb
212
199
  - lib/opentelemetry/instrumentation/ruby_kafka/patches/producer.rb
@@ -216,10 +203,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
216
203
  licenses:
217
204
  - Apache-2.0
218
205
  metadata:
219
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-ruby_kafka/0.20.1/file/CHANGELOG.md
206
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-ruby_kafka/0.21.0/file/CHANGELOG.md
220
207
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/ruby_kafka
221
208
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
222
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-ruby_kafka/0.20.1
209
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-ruby_kafka/0.21.0
223
210
  post_install_message:
224
211
  rdoc_options: []
225
212
  require_paths: