Class OtlpLogExporter

java.lang.Object
codes.grow.packages.openobserve.logs.OtlpLogExporter
All Implemented Interfaces:
LogExporter

public final class OtlpLogExporter extends Object implements LogExporter
LogExporter that sends OTLP/HTTP JSON (ExportLogsServiceRequest) to /api/{org}/v1/logs with a stream-name header. Stored rows use the OTLP column names (body, severity, severity_number, trace_id, span_id, flattened attributes and resource); OpenObserve does not store trace flags.
  • Constructor Details

    • OtlpLogExporter

      public OtlpLogExporter(Api api, String stream)
      Creates the exporter (use OpenObserveClient.logExporter(stream, true)).
      Parameters:
      api - request helper
      stream - target stream
  • Method Details

    • stream

      public String stream()
      Returns the (normalized) target stream.
      Returns:
      the stream
    • export

      public CompletableFuture<ExportResult> export(List<LogRecord> records, ExportOptions options)
      Sends one batch as OTLP JSON. A partialSuccess answer is reported as rejected records with a ValidationException.
      Specified by:
      export in interface LogExporter
      Parameters:
      records - records
      options - gzip flag and time budget
      Returns:
      future result
    • shutdown

      public CompletableFuture<Void> shutdown()
      Nothing to release.
      Specified by:
      shutdown in interface LogExporter
      Returns:
      a completed future