overengineeringstudio / overengineeringstudio/effect-utils

Add OTel file exporter for offline trace debugging

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

Nobody has claimed this yet.

type:bug type:feature
Dominant language
TypeScript
Stars
82
Forks
2
Avg merge
1d 8h
Merged PRs (30d)
121

Description

Goal

Provide an easy way to capture OpenTelemetry traces/spans to a file for offline debugging and analysis, without needing to run a collector or backend.

Use Cases

  1. Debugging Effect programs - Capture the execution trace of an Effect across IO boundaries
  2. Post-mortem analysis - Save traces to a file for later inspection
  3. Development - Quick trace capture without infrastructure setup
  4. Testing - Assert on trace structure in tests

Proposed API

import { OtelFileExporter } from '@overeng/utils/node'

// Option 1: Layer that writes spans to a JSON Lines file
const TracingLayer = OtelFileExporter.layer({ path: '/tmp/traces.jsonl' })

// Option 2: Effect that returns trace data
const trace = yield* OtelFileExporter.captureTrace(myEffect)
// trace: { spans: Span[], duration: number, ... }

// Option 3: Integration with @effect/opentelemetry
import { NodeSdk } from '@effect/opentelemetry'
const sdk = NodeSdk.layer(() => ({
  spanProcessor: new SimpleSpanProcessor(OtelFileExporter.make('/tmp/traces.jsonl'))
}))

Output Format

JSON Lines format (one span per line) for easy streaming and parsing:

{"traceId":"abc123","spanId":"def456","name":"myOperation","startTime":1234567890,"endTime":1234567891,"attributes":{"key":"value"},"events":[],"links":[]}
{"traceId":"abc123","spanId":"ghi789","parentSpanId":"def456","name":"childOperation",...}

Related Issues

Implementation Notes

  • Could build on @effect/opentelemetry or be standalone
  • Consider compatibility with standard OTLP JSON format
  • Should handle high-volume spans efficiently (buffering, async writes)
  • Consider log rotation for long-running processes

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.

Research direction

Start by reviewing the proposed @overengineeringstudio/effect-utils/node entry point and the @effect/opentelemetry NodeSdk integration. Resolve which OtelFileExporter API and OTLP-compatible JSON Lines behavior are in scope, then verify that captured spans support the listed debugging and testing use cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.