Class OTLPFileExporter

java.lang.Object
org.bluezoo.gumdrop.telemetry.json.OTLPFileExporter
All Implemented Interfaces:
TelemetryExporter

public class OTLPFileExporter extends Object implements TelemetryExporter
Exports telemetry data to OTLP JSON Lines files or stdout.

This exporter implements the OpenTelemetry Protocol File Exporter specification. Each line written is a complete OTLP JSON object (ExportTraceServiceRequest, ExportLogsServiceRequest, or ExportMetricsServiceRequest) followed by a newline character.

When configured with file paths, separate .jsonl files are maintained for each signal type (traces, logs, metrics) as required by the specification. When writing to stdout (the default), all signals share the same output stream.

Like the OTLP/HTTP exporter, data is queued and flushed by a background thread to avoid blocking the caller.

Configuration

 <component id="telemetry" class="org.bluezoo.gumdrop.telemetry.TelemetryConfig">
     <property name="service-name">my-service</property>
     <property name="exporter-type">file</property>
     <property name="file-traces-path">/var/log/otel/traces.jsonl</property>
     <property name="file-logs-path">/var/log/otel/logs.jsonl</property>
     <property name="file-metrics-path">/var/log/otel/metrics.jsonl</property>
     <property name="file-buffer-size">8192</property>
 </component>
 
Author:
Chris Burdess
  • Constructor Details

    • OTLPFileExporter

      public OTLPFileExporter(TelemetryConfig config)
      Creates a file exporter that writes all signals to stdout.
      Parameters:
      config - the telemetry configuration
    • OTLPFileExporter

      public OTLPFileExporter(TelemetryConfig config, Path tracesPath, Path logsPath, Path metricsPath)
      Creates a file exporter that writes to the specified file paths. Any null path causes that signal to be written to stdout.
      Parameters:
      config - the telemetry configuration
      tracesPath - path for traces JSONL file, or null for stdout
      logsPath - path for logs JSONL file, or null for stdout
      metricsPath - path for metrics JSONL file, or null for stdout
  • Method Details