feat(export): introduce LogExporter interface

Open
#139 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
typescript
Domain
api

Research direction

Start by reading src/sendLogs.ts and tracing its current batch, transport, and authentication responsibilities. Review the proposed files—src/exporters/types.ts, src/exporters/http-json.ts, src/exporters/websocket.ts, and src/exporters/index.ts—along with the configuration changes. Done means the default HTTP JSON and WebSocket behaviors remain compatible while the exporter interface and custom exporter path are available; note that v2.5.0 and #137 are dependencies.

Written by the indexing model from the issue text.

Description

enhancement Userale

Summary

Refactor sendLogs.ts into a pluggable LogExporter interface. This is the architectural keystone for OTLP support and custom export targets.

Motivation

Currently sendLogs.ts tightly couples batch management, transport (XHR/fetch/sendBeacon), and auth header construction. This makes it impossible to add new output formats (OTLP, custom backends) without duplicating the batch logic.

Proposed Interface

interface LogExporter {
  export(logs: Logging.Log[]): Promise<ExportResult>;
  flush(): Promise<void>;
  shutdown(): Promise<void>;
}

Implementation

  • src/exporters/types.ts — LogExporter interface
  • src/exporters/http-json.ts — Extract current sendLogs behavior (default)
  • src/exporters/websocket.ts — Extract current WebSocket behavior
  • src/exporters/index.ts — Factory: config → exporter
  • src/sendLogs.ts — Simplified to batch manager + exporter.export()

Config Changes

exporterType?: 'http-json' | 'otlp' | 'websocket' | 'custom';
exporter?: LogExporter;  // for custom exporters

Backward Compatibility

Existing users who set url: 'https://my-server/logs' must work identically. HttpJsonExporter is the default. No config change needed.

Depends On

  • v2.5.0 release (foundation)
  • #137 (toolchain modernization)
Dominant language
Jupyter Notebook
Stars
30
Forks
15
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/flagon

All issues in apache/flagon

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.