opentelemetry-instrumentation-faraday 0.23.4 → 0.24.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: 8ea341848bc1aa8420217f21a2ff895fc5d9e597531808b1c572cbe4174f15e2
4
- data.tar.gz: d1f4aa89558ca5b9d5cbf4dc46d70bf3e0cc2d10432eed3e3acab37fe8f3b540
3
+ metadata.gz: 30092c22c909e755e36b113d354e21781222fe1b93e1a41640dc1764a5bb4edd
4
+ data.tar.gz: f33f7d607f8590cd320fe19dec748317b656214770379071a116e24084dad5c0
5
5
  SHA512:
6
- metadata.gz: 6cbae80a960c606ad448c4360f128401a9f960ce31fbeff77242bca0d2b0acaff21cd83916c64d6c19e5453d9b579cf5552c42fb9b5576860fab83fdc071fbc0
7
- data.tar.gz: 03aaf51ffb177103b12f4ec38ef4f4c6f79e236ba2c62b9e5b4e9ac22be68ce389f0893423dde288bdc0134a00580a3e6dac0687ac7eb1ba1d4bfab385d98688
6
+ metadata.gz: 5f1b7344eb1522a38aff5c07315742d42b57c16b76d1f2525e8ec5db8b4181cbad7a0fa29c4d83dc0ef82f7052eaf4c11170d42b1738b68e4766208b0247b193
7
+ data.tar.gz: 61286db2222c234660741d7f10842384e8d5074a479068731e4c95d831ac05950a74cb334f252ac06cd70b70460bc632d297173e30981323a73aa1a56f137384
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release History: opentelemetry-instrumentation-faraday
2
2
 
3
+ ### v0.24.0 / 2024-02-20
4
+
5
+ * ADDED: Faraday add support for internal spans
6
+
3
7
  ### v0.23.4 / 2023-11-23
4
8
 
5
9
  * CHANGED: Applied Rubocop Performance Recommendations [#727](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/727)
@@ -20,6 +20,7 @@ module OpenTelemetry
20
20
  defined?(::Faraday)
21
21
  end
22
22
 
23
+ option :span_kind, default: :client, validate: %i[client internal]
23
24
  option :peer_service, default: nil, validate: :string
24
25
 
25
26
  private
@@ -25,11 +25,13 @@ module OpenTelemetry
25
25
 
26
26
  def call(env)
27
27
  http_method = HTTP_METHODS_SYMBOL_TO_STRING[env.method]
28
+ config = Faraday::Instrumentation.instance.config
29
+
28
30
  attributes = span_creation_attributes(
29
- http_method: http_method, url: env.url
31
+ http_method: http_method, url: env.url, config: config
30
32
  )
31
33
  tracer.in_span(
32
- "HTTP #{http_method}", attributes: attributes, kind: :client
34
+ "HTTP #{http_method}", attributes: attributes, kind: config.fetch(:span_kind)
33
35
  ) do |span|
34
36
  OpenTelemetry.propagation.inject(env.request_headers)
35
37
 
@@ -39,21 +41,23 @@ module OpenTelemetry
39
41
 
40
42
  private
41
43
 
42
- attr_reader :app
43
-
44
- def span_creation_attributes(http_method:, url:)
44
+ def span_creation_attributes(http_method:, url:, config:)
45
45
  instrumentation_attrs = {
46
46
  'http.method' => http_method,
47
- 'http.url' => OpenTelemetry::Common::Utilities.cleanse_url(url.to_s)
47
+ 'http.url' => OpenTelemetry::Common::Utilities.cleanse_url(url.to_s),
48
+ 'faraday.adapter.name' => app.class.name
48
49
  }
49
50
  instrumentation_attrs['net.peer.name'] = url.host if url.host
50
- config = Faraday::Instrumentation.instance.config
51
51
  instrumentation_attrs['peer.service'] = config[:peer_service] if config[:peer_service]
52
+
52
53
  instrumentation_attrs.merge!(
53
54
  OpenTelemetry::Common::HTTP::ClientContext.attributes
54
55
  )
55
56
  end
56
57
 
58
+ # Versions prior to 1.0 do not define an accessor for app
59
+ attr_reader :app if Gem::Version.new(Faraday::VERSION) < Gem::Version.new('1.0.0')
60
+
57
61
  def tracer
58
62
  Faraday::Instrumentation.instance.tracer
59
63
  end
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Faraday
10
- VERSION = '0.23.4'
10
+ VERSION = '0.24.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-faraday
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.4
4
+ version: 0.24.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-11-23 00:00:00.000000000 Z
11
+ date: 2024-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -142,28 +142,28 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 1.56.1
145
+ version: 1.60.1
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.56.1
152
+ version: 1.60.1
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rubocop-performance
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 1.19.1
159
+ version: '1.20'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 1.19.1
166
+ version: '1.20'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: simplecov
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -228,10 +228,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
228
228
  licenses:
229
229
  - Apache-2.0
230
230
  metadata:
231
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-faraday/0.23.4/file/CHANGELOG.md
231
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-faraday/0.24.0/file/CHANGELOG.md
232
232
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/faraday
233
233
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
234
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-faraday/0.23.4
234
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-faraday/0.24.0
235
235
  post_install_message:
236
236
  rdoc_options: []
237
237
  require_paths: