Class: Snails::Logger::OTLPTransport
- Defined in:
- runtime/snails/logger/otlp_transport.rbs,
runtime/snails/logger/otlp_transport.rb
Defined Under Namespace
Classes: DeliveryError
Constant Summary collapse
- OPEN_TIMEOUT =
Timeouts keep a dead endpoint from holding a worker for long.
2- READ_TIMEOUT =
2- MAX_ATTEMPTS =
One retry covers a transient 5xx or a dropped connection; a 4xx is permanent (bad token, malformed batch, too large) and is not retried.
2
Instance Method Summary collapse
-
#after_fork ⇒ void
drop the parent's HTTP session in a forked child.
-
#deliver(records) ⇒ void
encode one batch and enqueue the delivery job.
-
#initialize(endpoint:, token:) ⇒ OTLPTransport
constructor
configure the destination.
-
#send_encoded(body) ⇒ Boolean
post one encoded OTLP batch.
Constructor Details
#initialize(endpoint:, token:) ⇒ OTLPTransport
configure the destination. The endpoint is the receiver's base URL
(scheme, host, and optional path prefix); the transport appends the OTLP
logs path itself. A trailing slash on the base is absorbed. The token is
sent as Authorization: Bearer. Both are validated here so a typo fails
at boot rather than on the first batch.
55 |
# File 'runtime/snails/logger/otlp_transport.rb', line 55
def initialize: (endpoint: String, token: String) -> void
|
Instance Method Details
#after_fork ⇒ void
drop the parent's HTTP session in a forked child. The socket and the lock belong to the parent process; a child that inherited them would write on a connection another process owns.
83 |
# File 'runtime/snails/logger/otlp_transport.rb', line 83
def after_fork: () -> void
|
#deliver(records) ⇒ void
encode one batch and enqueue the delivery job. It never performs HTTP; the transport contract stays the hand-off point.
A process without a registered executor would run the job at the call site and block the caller, so that case is refused. The first refusal is reported to the logger; later batches stay local without repeating the warning.
99 |
# File 'runtime/snails/logger/otlp_transport.rb', line 99
def deliver: (Array[Record] records) -> void
|
#send_encoded(body) ⇒ Boolean
post one encoded OTLP batch. A 2xx succeeds; a 4xx raises immediately; a 5xx or a network error is retried once.
120 |
# File 'runtime/snails/logger/otlp_transport.rb', line 120
def send_encoded: (untyped body) -> bool
|