helios-opentelemetry-sdk 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Gemfile.lock +1 -1
- data/lib/helios/opentelemetry/sdk/instrumentations.rb +7 -0
- data/lib/helios/opentelemetry/sdk/net_http_patch.rb +31 -0
- data/lib/helios/opentelemetry/sdk/version.rb +1 -1
- data/lib/helios/opentelemetry/semantic_attributes.rb +10 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ce889a94723b9b8f7b2c8da0a10608f5ae627841543649b3716cc01c5d915c2c
|
|
4
|
+
data.tar.gz: ef7bc57d8507c1bb613a603197414700a9e428a58f9d271d5b3c19d975a97f68
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1199e9514864e6497bd3cff0f9f2c311bd6711298ac4d6e7f94834bcb02c84d90ce08b0404ca76b2b6425736d027c3e91e67eb5e846ddfb5c01a4a8af36eae70
|
|
7
|
+
data.tar.gz: a9d5cf728fda4d6745386218ffc55e7df3bbf0a1ac6119c404c94379106f7f570c51905c3f484046636b51604765dad633e7b1d82ca6f193ac159191a90ab3a7
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
require_relative '../semantic_attributes'
|
|
3
|
+
|
|
4
|
+
module NetHttpPatch
|
|
5
|
+
# Module to prepend to Net::HTTP for instrumentation
|
|
6
|
+
module Instrumentation
|
|
7
|
+
def request(req, body = nil, &block)
|
|
8
|
+
current_span = OpenTelemetry::Trace.current_span
|
|
9
|
+
current_span.set_attribute(Helios::OpenTelemetry::SemanticAttributes::HTTP_REQUEST_HEADERS, collect_headers(req))
|
|
10
|
+
unless req.body.nil?
|
|
11
|
+
current_span.set_attribute(Helios::OpenTelemetry::SemanticAttributes::HTTP_REQUEST_BODY,
|
|
12
|
+
body.is_a?(String) ? body : body.to_s)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
super(req, body, &block).tap do |response|
|
|
16
|
+
current_span.set_attribute(Helios::OpenTelemetry::SemanticAttributes::HTTP_RESPONSE_HEADERS,
|
|
17
|
+
collect_headers(response))
|
|
18
|
+
current_span.set_attribute(Helios::OpenTelemetry::SemanticAttributes::HTTP_RESPONSE_BODY, response.body)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def collect_headers(obj)
|
|
23
|
+
headers = {}
|
|
24
|
+
obj.each_header do |k, v|
|
|
25
|
+
headers[k] = v
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
headers.to_json
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
module Helios
|
|
2
|
+
module OpenTelemetry
|
|
3
|
+
class SemanticAttributes
|
|
4
|
+
HTTP_REQUEST_BODY = 'http.request.body'
|
|
5
|
+
HTTP_REQUEST_HEADERS = 'http.request.headers'
|
|
6
|
+
HTTP_RESPONSE_BODY = 'http.response.body'
|
|
7
|
+
HTTP_RESPONSE_HEADERS = 'http.response.headers'
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
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.12
|
|
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-08-
|
|
11
|
+
date: 2022-08-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -130,7 +130,9 @@ files:
|
|
|
130
130
|
- helios-opentelemetry-sdk.gemspec
|
|
131
131
|
- lib/helios/opentelemetry/sdk.rb
|
|
132
132
|
- lib/helios/opentelemetry/sdk/instrumentations.rb
|
|
133
|
+
- lib/helios/opentelemetry/sdk/net_http_patch.rb
|
|
133
134
|
- lib/helios/opentelemetry/sdk/version.rb
|
|
135
|
+
- lib/helios/opentelemetry/semantic_attributes.rb
|
|
134
136
|
homepage: https://gethelios.dev
|
|
135
137
|
licenses:
|
|
136
138
|
- Apache-2.0
|