opentelemetry-instrumentation-ruby_kafka 0.20.1 → 0.20.2

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: 3fc93b53a9e290e09a9682342efefccab2eeca8ec6de527eae81c2f16fca74d7
4
+ data.tar.gz: 60cd6ff58f39eac71c8163a2e734aa0ac3d6f51eae6de0fc855c448088f69bab
5
5
  SHA512:
6
- metadata.gz: 12f07057792fad0e23b53e50259fca79aa36571b191ea2418f89d92704cb233d256bffa43c98a793c4bc2eec8d4ed1810ec7ae1deae3a66fa08d4df49d72a53c
7
- data.tar.gz: f52ce0dadc1acfc3062f723379fae88dd9bde6fe2ccff6113f59b5c45831709bd5503ffb25399ce82484c976b877e8cc38819e1e8d59c5c67062762a7f9a9f91
6
+ metadata.gz: c8b62e4319b6970795cb314c0550e07d4d83be4a753850a8c0bbe0a1cfe7f231d2c6239558dfeb7201c0355b35b3f8bb3e663daa4d2b7501694a4e2f572b6b01
7
+ data.tar.gz: 7db39cffc72d33aab5fad426af7eb05f2457b1a2ede39986ac4f535dbb8e0c9b12651019892acc5fe87429ad5d577af4d21a2a463f9d76b82d72d693887bbe5d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release History: opentelemetry-instrumentation-ruby_kafka
2
2
 
3
+ ### v0.20.2 / 2023-08-09
4
+
5
+ * FIXED: propagate context from async producer
6
+
3
7
  ### v0.20.1 / 2023-06-05
4
8
 
5
9
  * 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
@@ -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} send", 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.20.2'
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.20.2
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-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.50.2
131
+ version: 1.55.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.55.1
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: ruby-kafka
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -207,6 +207,7 @@ files:
207
207
  - lib/opentelemetry/instrumentation.rb
208
208
  - lib/opentelemetry/instrumentation/ruby_kafka.rb
209
209
  - lib/opentelemetry/instrumentation/ruby_kafka/instrumentation.rb
210
+ - lib/opentelemetry/instrumentation/ruby_kafka/patches/async_producer.rb
210
211
  - lib/opentelemetry/instrumentation/ruby_kafka/patches/client.rb
211
212
  - lib/opentelemetry/instrumentation/ruby_kafka/patches/consumer.rb
212
213
  - lib/opentelemetry/instrumentation/ruby_kafka/patches/producer.rb
@@ -216,10 +217,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
216
217
  licenses:
217
218
  - Apache-2.0
218
219
  metadata:
219
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-ruby_kafka/0.20.1/file/CHANGELOG.md
220
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-ruby_kafka/0.20.2/file/CHANGELOG.md
220
221
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/ruby_kafka
221
222
  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
223
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-ruby_kafka/0.20.2
223
224
  post_install_message:
224
225
  rdoc_options: []
225
226
  require_paths: