Class: Logtide::Transport::Otlp
- Inherits:
-
Object
- Object
- Logtide::Transport::Otlp
- Defined in:
- lib/logtide/transport/otlp.rb
Overview
Exports spans as OTLP/JSON to /v1/otlp/traces (spec 005 section 3). Shares the retryable/network-error contract with the log transport.
Constant Summary collapse
Instance Method Summary collapse
- #deliver(spans) ⇒ Object
-
#initialize(url:, api_key:, resource:, timeout: 10) ⇒ Otlp
constructor
A new instance of Otlp.
Constructor Details
#initialize(url:, api_key:, resource:, timeout: 10) ⇒ Otlp
Returns a new instance of Otlp.
17 18 19 20 21 22 |
# File 'lib/logtide/transport/otlp.rb', line 17 def initialize(url:, api_key:, resource:, timeout: 10) @uri = URI.parse(url) @api_key = api_key @resource = resource @timeout = timeout end |
Instance Method Details
#deliver(spans) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/logtide/transport/otlp.rb', line 24 def deliver(spans) body = JSON.generate(payload(spans)) response = client.request(build_request(body)) Response.new(status: response.code.to_i, retry_after: nil) rescue *HTTP::NETWORK_ERRORS => e raise NetworkError, e. end |