helios-opentelemetry-sdk 0.1.19 → 0.1.20

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: e1333d4f45a6affbdc086bb2e8e98f8871e7a295a50e4dd87f624b60ca4be78e
4
- data.tar.gz: b50075cf28a40a5ccc36dd39c46d6c1323b8a6514e027f558f3fc1cb4439e0e6
3
+ metadata.gz: a91efee8919de8c1d6ba5535e9bd3e347f3402545739261b272e33e1a64e036e
4
+ data.tar.gz: 1d0c7e40082bcb8153aacd08b36ed919589d32836a17cd65ba16ef68db13391c
5
5
  SHA512:
6
- metadata.gz: d6467ee1a6eabce6fb8a743e536c8e83ba3bbdb9705b62fd9793552ef163b9d69a43649e13d948f686d4d4a6cbb4da02ad3f90e5a65b59d66d497a7757d89a91
7
- data.tar.gz: 9b96c5e12e92befd75f0d5f650b2119e79279efe19e4b2aa4e1b69cceb7939a4f90f8eddc5ee495fa0bbfa72c435ae86ae4012634f6c514f93233aa00bf3337d
6
+ metadata.gz: 62f535badbe0f1c481f15dd17e110209233c99025b8d544988e264e78ff23d5b70e12bc10579748f33a0cc23fcf0716b8b4bcade9e2ab3509a1150b1795ef88d
7
+ data.tar.gz: a935beb8953928cbd407dc71ddad09a6f1134f8d39c5d385e40eafdbf273f1976657f72a5fc114c64595a6ad53b52a2899f8878c8117c699458be3f8867e2568
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- helios-opentelemetry-sdk (0.1.19)
4
+ helios-opentelemetry-sdk (0.1.20)
5
5
  opentelemetry-exporter-otlp (~> 0.22.0)
6
6
  opentelemetry-instrumentation-all (~> 0.25.0)
7
7
  opentelemetry-instrumentation-rspec (~> 0.2.0)
@@ -7,18 +7,10 @@ module NetHttpPatch
7
7
  module Instrumentation
8
8
  def request(req, body = nil, &block)
9
9
  current_span = OpenTelemetry::Trace.current_span
10
- current_span.set_attribute(Helios::OpenTelemetry::SemanticAttributes::HTTP_REQUEST_HEADERS,
11
- collect_headers(req))
12
- current_span.set_attribute(OpenTelemetry::SemanticConventions::Trace::HTTP_URL, req.uri&.to_s)
13
- unless body.nil?
14
- current_span.set_attribute(Helios::OpenTelemetry::SemanticAttributes::HTTP_REQUEST_BODY,
15
- body.is_a?(String) ? body : body.to_s)
16
- end
10
+ extract_request_attributes(current_span, req, body)
17
11
 
18
12
  super(req, body, &block).tap do |response|
19
- current_span.set_attribute(Helios::OpenTelemetry::SemanticAttributes::HTTP_RESPONSE_HEADERS,
20
- collect_headers(response))
21
- current_span.set_attribute(Helios::OpenTelemetry::SemanticAttributes::HTTP_RESPONSE_BODY, response.body)
13
+ extract_response_attributes(current_span, response)
22
14
  end
23
15
  end
24
16
 
@@ -37,6 +29,17 @@ module NetHttpPatch
37
29
  span.set_attribute(Helios::OpenTelemetry::SemanticAttributes::HTTP_REQUEST_BODY,
38
30
  body.is_a?(String) ? body : body.to_s)
39
31
  end
32
+
33
+ url = req.uri&.to_s
34
+ sem_conv = OpenTelemetry::SemanticConventions::Trace
35
+ if url.nil?
36
+ scheme = span.attributes[sem_conv::HTTP_SCHEME]
37
+ hostname = span.attributes[sem_conv::HTTP_HOST] || span.attributes[sem_conv::NET_PEER_NAME]
38
+ target = span.attributes[sem_conv::HTTP_TARGET]
39
+ url = "#{scheme}://#{hostname}#{target}" if scheme && hostname && target
40
+ end
41
+
42
+ span.set_attribute(sem_conv::HTTP_URL, url) unless url.nil?
40
43
  rescue StandardError => e
41
44
  ::OpenTelemetry.logger.debug("Error extracting net http request attributes: #{e}")
42
45
  end
@@ -1,7 +1,7 @@
1
1
  module Helios
2
2
  module OpenTelemetry
3
3
  module SDK
4
- VERSION = '0.1.19'
4
+ VERSION = '0.1.20'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: helios-opentelemetry-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.19
4
+ version: 0.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Team Helios
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-04 00:00:00.000000000 Z
11
+ date: 2022-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler