Package codes.grow.packages.datadoglogs
Class DatadogLogExporter
java.lang.Object
codes.grow.packages.datadoglogs.DatadogLogExporter
- All Implemented Interfaces:
LogExporter
LogExporter for POST {intake}/api/v2/logs (API.md section 5; DECISIONS 4, 7).
Maps records to Datadog JSON, truncates oversized messages, splits batches at 1000 entries / 5
MB, gzips when asked and sends with header DD-API-KEY only (the application key is never
sent to the intake). The intake POST is retried like an idempotent call (429, 5xx, network
errors; duplicates are possible after an ambiguous failure).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final recordOne intake request body before compression.static final recordRequest limits; values above the Datadog limits are capped. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionMaps and splits records into intake request bodies (no I/O).export(List<LogRecord> records, ExportOptions options) Sends the records.limits()Returns the request limits.voidsendPayload(String body, boolean gzip) Posts one JSON array body to the intake (blocking).sendPayloadAsync(String body, boolean gzip) Posts one JSON array body to the intake.shutdown()Nothing to release; the client owns the transport.
-
Field Details
-
INTAKE_PATH
Intake path.- See Also:
-
-
Method Details
-
limits
Returns the request limits.- Returns:
- the limits
-
encode
Maps and splits records into intake request bodies (no I/O).- Parameters:
records- records- Returns:
- the bodies
-
export
Sends the records. Completes withaccepted/rejectedand the error of the first failing request (later chunks count as rejected); never completes exceptionally for service errors.- Specified by:
exportin interfaceLogExporter- Parameters:
records- recordsoptions- gzip flag and timeout- Returns:
- a future with the result
-
sendPayload
Posts one JSON array body to the intake (blocking).- Parameters:
body- JSON array textgzip- whether to gzip the body- Throws:
DatadogLogsException- the mapped error
-
sendPayloadAsync
Posts one JSON array body to the intake.- Parameters:
body- JSON array textgzip- whether to gzip the body (Content-Encoding: gzip)- Returns:
- a future completed on a 2xx answer, failed with the mapped error otherwise
-
shutdown
Nothing to release; the client owns the transport.- Specified by:
shutdownin interfaceLogExporter- Returns:
- a completed future
-