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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/helios/opentelemetry/sdk/patches/net_http_patch.rb +13 -10
- data/lib/helios/opentelemetry/sdk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a91efee8919de8c1d6ba5535e9bd3e347f3402545739261b272e33e1a64e036e
|
4
|
+
data.tar.gz: 1d0c7e40082bcb8153aacd08b36ed919589d32836a17cd65ba16ef68db13391c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62f535badbe0f1c481f15dd17e110209233c99025b8d544988e264e78ff23d5b70e12bc10579748f33a0cc23fcf0716b8b4bcade9e2ab3509a1150b1795ef88d
|
7
|
+
data.tar.gz: a935beb8953928cbd407dc71ddad09a6f1134f8d39c5d385e40eafdbf273f1976657f72a5fc114c64595a6ad53b52a2899f8878c8117c699458be3f8867e2568
|
data/Gemfile.lock
CHANGED
@@ -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
|
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
|
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
|
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.
|
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-
|
11
|
+
date: 2022-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|