Class LokiOtlpExporter

java.lang.Object
codes.grow.packages.loki.LokiOtlpExporter
All Implemented Interfaces:
LogExporter

public final class LokiOtlpExporter extends Object implements LogExporter
LogExporter that writes OTLP/JSON to POST /otlp/v1/logs. Loki then decides which resource attributes become labels (its OTLP defaults: service.name, deployment.environment, …) and stores the rest as structured metadata.
  • Constructor Details

    • LokiOtlpExporter

      public LokiOtlpExporter(LokiClient client)
      Creates an exporter.
      Parameters:
      client - client (and tenant) to push with
  • Method Details

    • export

      public CompletableFuture<ExportResult> export(List<LogRecord> records, ExportOptions options)
      Description copied from interface: LogExporter
      Exports a batch. The future completes with the accepted/rejected counts; it may also complete exceptionally (treated as "all rejected"). Cancelling the future cancels the export.
      Specified by:
      export in interface LogExporter
      Parameters:
      records - records to send (never empty)
      options - gzip flag and time budget
      Returns:
      the export result
    • shutdown

      public CompletableFuture<Void> shutdown()
      Description copied from interface: LogExporter
      Releases resources. Called once by BatchProcessor.shutdown.
      Specified by:
      shutdown in interface LogExporter
      Returns:
      completes when the exporter is closed