Introduction
Autotel is a zero-boilerplate OpenTelemetry wrapper for TypeScript. It replaces 30+ lines of SDK setup with a single init() call and replaces manual span lifecycle with functional trace() wrappers.
Core Philosophy
Section titled “Core Philosophy”- Write once, observe everywhere: One instrumentation surface; many backends via OTLP.
- Functional API: Wrap handlers and functions with
trace(),span(),instrument(); avoid manual span lifecycle. - Structured errors: Errors carry
message,why,fix,linkso agents and users can diagnose and act. - Request context: Use
getRequestLogger()when you need one coherent snapshot per request.
Core API
Section titled “Core API”| Need | API / entry point |
| --------------------------- | ------------------------------------------------------------------------------- |
| Wrap a function with a span | trace(fn), span(name, fn), instrument({ key, fn }) |
| Request-scoped attributes | getRequestLogger(ctx?) |
| Structured throw | createStructuredError({ message, why?, fix?, link?, status?, code?, cause? }) |
| Parse API errors (client) | parseError(err) |
| Product/analytics events | track(name, attributes) |
| Init (once at startup) | init({ service, ... }) |
| Testing | createTraceCollector() from autotel/testing |
Installation
Section titled “Installation”npm install autotel# orpnpm add autotelFor auto-instrumentation (HTTP, databases, etc.), also install:
npm install @opentelemetry/auto-instrumentations-node