export

package
v0.15.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package export is OpticTrace's pluggable output layer: every governed telemetry record (post-restriction, post-redaction — exporters can never see raw sensitive data) fans out to the exporters declared under telemetry.exporters in optic.yaml.

Built-in exporter types:

file     append JSONL to disk, size-based rotation
webhook  POST JSON batches to an HTTP endpoint
otlp     emit OpenTelemetry spans to a collector (OTLP/HTTP + JSON)
command  THE CUSTOM PLUGIN HOOK — spawn any executable and stream one
         JSON record per line to its stdin; write plugins in any
         language to ship data to Kafka, S3, a SIEM, anywhere.

Delivery model: at-most-once, deliberately. Each exporter gets its own bounded queue and worker; a slow or dead exporter drops its own records (counted per exporter) and can never block the request path or starve other exporters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher struct {
	// contains filtered or unexported fields
}

Dispatcher owns one worker per configured exporter.

func New

func New(cfgs []config.ExporterCfg, logger *slog.Logger, m Metrics, serviceName string) (*Dispatcher, error)

New builds exporters from config and starts their workers.

func (*Dispatcher) AcceptsAppLogs added in v0.11.0

func (d *Dispatcher) AcceptsAppLogs() bool

AcceptsAppLogs reports whether any configured exporter takes log lines, so the caller can skip the work entirely when none do.

func (*Dispatcher) Enqueue

func (d *Dispatcher) Enqueue(rec *store.Record)

func (*Dispatcher) EnqueueAppLog added in v0.11.0

func (d *Dispatcher) EnqueueAppLog(l *ext.AppLog)

Enqueue hands a record to every exporter without ever blocking. EnqueueAppLog fans one governed log line out to every exporter that accepts them. Exporters without app-log support simply do not receive it.

func (*Dispatcher) Shutdown

func (d *Dispatcher) Shutdown()

Shutdown flushes pending batches and closes every exporter.

func (*Dispatcher) Stats

func (d *Dispatcher) Stats() []Stat

Stats reports per-exporter delivery counters.

type Exporter

type Exporter = ext.Exporter

Exporter delivers batches of governed records to one destination. The contract lives in ext so out-of-tree plugins can implement it; this is an alias, not a parallel definition.

type Metrics

type Metrics interface {
	ExportDelivered(exporter string, n int)
	ExportFailed(exporter string, n int)
	ExportDropped(exporter string)
}

Metrics is the hook back into the Prometheus collector (nil-safe).

type Stat

type Stat struct {
	Name      string `json:"name"`
	Type      string `json:"type"`
	Delivered int64  `json:"delivered"`
	Failed    int64  `json:"failed"`
	Dropped   int64  `json:"dropped"`
	QueueLen  int    `json:"queue_len"`
}

Stat is a point-in-time view of one exporter, for /api/system.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL