Class OtlpLogExporter
java.lang.Object
codes.grow.packages.otelcollector.OtlpLogExporter
- All Implemented Interfaces:
LogExporter
LogExporter (SPEC section 4) that sends records to the collector over OTLP with the
official OpenTelemetry log exporter: POST {logsUrl} (application/x-protobuf) or
gRPC LogsService/Export. Retries (HTTP 429/502/503/504, retryable gRPC codes) are done by
the exporter within OtelCollectorConfig.exportTimeout(). A partial success reports
rejected with a ValidationException.
Exports run one at a time (the outcome of each request is read from the exporter's sender).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.opentelemetry.sdk.common.InstrumentationScopeInfoInstrumentation scope of records exported by this class. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionendpoint()Returns the endpoint records are sent to (logsUrlfor HTTP,grpcUrlfor gRPC).export(List<LogRecord> records, ExportOptions options) Exportsrecordsin one OTLP request.static io.opentelemetry.sdk.logs.export.LogRecordExporterofficialExporter(OtelCollectorConfig config, boolean gzip) Builds the official OTLP log record exporter for a collector config (also used for theLoggerProviderofinitTelemetry).shutdown()Waits for in-flight exports and releases connections.
-
Field Details
-
SCOPE
public static final io.opentelemetry.sdk.common.InstrumentationScopeInfo SCOPEInstrumentation scope of records exported by this class.
-
-
Constructor Details
-
OtlpLogExporter
Creates an exporter.- Parameters:
config- collector config (endpoint, protocol, headers, compression, TLS, timeout)
-
-
Method Details
-
endpoint
Returns the endpoint records are sent to (logsUrlfor HTTP,grpcUrlfor gRPC).- Returns:
- the endpoint
-
officialExporter
public static io.opentelemetry.sdk.logs.export.LogRecordExporter officialExporter(OtelCollectorConfig config, boolean gzip) Builds the official OTLP log record exporter for a collector config (also used for theLoggerProviderofinitTelemetry).- Parameters:
config- collector configgzip- whether to compress (only when the config compression is gzip)- Returns:
- the exporter
-
export
Exportsrecordsin one OTLP request. The future never fails: failures are reported inExportResult.error()with every record counted as rejected.- Specified by:
exportin interfaceLogExporter- Parameters:
records- recordsoptions- gzip and deadline- Returns:
- the result
-
shutdown
Waits for in-flight exports and releases connections. Idempotent.- Specified by:
shutdownin interfaceLogExporter- Returns:
- a future completed when shut down
-