Documentation
¶
Overview ¶
Package filereader reads OTLP telemetry from JSONL files written by the OpenTelemetry Collector's file exporter. It feeds data into the same ring buffers used by the TCP receiver, so all query/snapshot logic works unchanged.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Directory string // Base directory (e.g., /tank/otel)
Verbose bool // Enable verbose logging
// ActiveOnly when true (default) only loads active files like traces.jsonl,
// skipping rotated archives like traces-2025-12-09T13-10-56.jsonl.
// This prevents loading gigabytes of historical data on startup.
ActiveOnly bool
// Optional: time cutoff - only load data newer than this
// Zero value means load everything (future feature)
SinceTime time.Time
// Storage capacities — used by tail-seek to avoid reading entire files
// when only the last N entries fit in ring buffers. Zero means read all.
SpanCapacity int
LogCapacity int
MetricCapacity int
}
Config holds configuration for a FileSource.
type FileSource ¶
type FileSource struct {
// contains filtered or unexported fields
}
FileSource reads OTLP telemetry from a directory of JSONL files. It watches for new data and feeds it into the storage ring buffers.
func New ¶
func New(cfg Config, storage StorageReceiver) (*FileSource, error)
New creates a new FileSource that reads from the given directory. The directory should contain subdirectories: traces/, logs/, metrics/ with .jsonl files inside them.
func (*FileSource) Directory ¶
func (fs *FileSource) Directory() string
Directory returns the base directory being watched.
func (*FileSource) Start ¶
func (fs *FileSource) Start(ctx context.Context) error
Start begins watching the directory and loading initial data. It returns after initial load completes; watching continues in background.
func (*FileSource) Stop ¶
func (fs *FileSource) Stop()
Stop stops the file watcher and waits for goroutines to finish.
type Stats ¶
type Stats struct {
Directory string `json:"directory"`
WatchedDirs []string `json:"watched_dirs"`
FilesTracked int `json:"files_tracked"`
}
Stats returns statistics about the file source.
type StorageReceiver ¶
type StorageReceiver interface {
ReceiveSpans(ctx context.Context, resourceSpans []*tracepb.ResourceSpans) error
ReceiveLogs(ctx context.Context, resourceLogs []*logspb.ResourceLogs) error
ReceiveMetrics(ctx context.Context, resourceMetrics []*metricspb.ResourceMetrics) error
}
StorageReceiver is the interface that storage must implement to receive telemetry. This matches the methods on ObservabilityStorage.