Package codes.grow.packages.betterstack
Class BetterStackOtlpLogExporter
java.lang.Object
codes.grow.packages.betterstack.BetterStackOtlpLogExporter
- All Implemented Interfaces:
LogExporter
LogExporter that sends OTLP/HTTP logs to the source's ingesting host (POST
{url}/v1/logs, Authorization: Bearer <source token>), protobuf by default or OTLP/JSON.
Records are grouped by resource; batches are split so that no request exceeds
maxRequestBytes. A partial_success answer counts its records as rejected. Exports are
retried like idempotent calls (duplicates are possible after an ambiguous failure). Get one from
BetterStackClient.otlpExporter().
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Encodes records as one request body (protobuf bytes or OTLP/JSON text).export(List<LogRecord> records, ExportOptions options) Sends the records; the future never fails for service errors (seeLogExporter).protocol()Returns the payload format.Returns the instrumentation scope name.Posts one OTLP request forrecords(no splitting).Asynchronoussend(List, boolean).shutdown()Nothing to release; the client owns the transport.
-
Field Details
-
OTLP_LOGS_PATH
OTLP logs path on the ingesting host.- See Also:
-
-
Method Details
-
protocol
Returns the payload format.- Returns:
- the protocol
-
scopeName
Returns the instrumentation scope name.- Returns:
- the name
-
encode
Encodes records as one request body (protobuf bytes or OTLP/JSON text).- Parameters:
records- records- Returns:
- the body
-
export
Sends the records; the future never fails for service errors (seeLogExporter).- Specified by:
exportin interfaceLogExporter- Parameters:
records- recordsoptions- gzip flag and time budget- Returns:
- the result
-
send
Posts one OTLP request forrecords(no splitting).- Parameters:
records- recordsgzip- gzip-compress the body- Returns:
- the partial success when the service reports rejected records
- Throws:
BetterStackException- mapped like the ingest API (403 authentication, 402 quota)
-
sendAsync
public CompletableFuture<Optional<OtlpLogs.PartialSuccess>> sendAsync(List<LogRecord> records, boolean gzip) Asynchronoussend(List, boolean).- Parameters:
records- recordsgzip- gzip-compress the body- Returns:
- a future with the partial success, if any
-
shutdown
Nothing to release; the client owns the transport.- Specified by:
shutdownin interfaceLogExporter- Returns:
- a completed future
-