autotel-core
Explains when to reach for trace vs span vs request logger vs events in Autotel, and the package exports each lives behind.
Skill by jagreehal
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/jagreehal-autotel-core
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/autotel-core
What's inside
- Skill name
autotel-core- Description
- Explains when to reach for trace vs span vs request logger vs events in Autotel, and the package exports each lives behind. Use this skill when setting up autotel, calling init(), or choosing between the core APIs. Do not use for a specific framework's wiring — use skill autotel-frameworks or skill autotel-adapters — or for finding which handlers are uninstrumented — use skill find-observability-gaps.
- License
- Apache-2.0
- Instructions
- 268 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Autotel: Core
OpenTelemetry instrumentation for Node.js and edge. Instrument once; stream to any OTLP backend. Use `trace()`/`span()` for spans, `getRequestLogger()` for one snapshot per request, `createStructuredError`/`parseError` for errors, `track()` for product events.
Event guidance: for new instrumentation, emit events as correlated logs (via request logger or logging pipeline bridged to OTel Logs API). Do not introduce new direct span-event dependencies for business/exception events.
## When to Use What
| Need | API | Import |
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
| Trace reusable or immediate work | `trace(fn)`, `trace(name, fn)`, `instrument({ key, fn })`, `trace.run(name, ctx => result)`, `span(name, fn)` | `autotel` |
| Request-scoped attributes + emit once | `getRequestLogger(ctx?)` → `.set()`, `.emitNow()` | `autotel` |
| Throw with why/fix/link | `createStructuredError({ message, why?, fix?, link?, status? })` | `autotel` |
| Parse API errors (client) | `parseError(err)` → `message`, `why`, `fix`, `link` | `autotel` |
| Product/analytics events | `track(name, attrs)` or `Event` from `autotel/event` | `autotel`, `autotel/event` |
| Init (once at startup) | `init({ service, ... })` | `autotel` |
| Same error thrown from many places | `defineErrorCatalog(ns, entries)` → typed builders + `.match()` | `autotel` |
| Error budgets and burn-rate alerts | `createSloTracker()`, `evaluateBurnRateAlert()` | `autotel/slo` |
| Split a metric by feature flag | OpenFeature: automatic from `init()`. Otherwise `recordFeatureFlag({ key, value })` | `autotel/feature-flags` |
| Flush telemetry on SIGTERM / crash | `init({ processHandlers: true })` | `autotel` |
| Testing | `createTraceCollector()`, `InMemorySpanExporter` | `autotel/testing`, `autotel/exporters` |
Request logger requires an active span. Wrap HTTP handlers with `trace()` or framework middleware that creates a span, then call `getRequestLogger()` inside.
`processHandlers` is opt-in: importing `autotel` registers no signal or crash listeners. Pass `true` for the defaults (SIGTERM/SIGINT plus fatal errors, 2s shutdown timeout), or an object to override `signals`, `fatalErrors`, or `shutdownTimeoutMs`. On a signal or crash, the handlers end the spans still running as failed (`error.type` is the signal or the error's class), so a stopped job exports its whole trace. Leave it off and call `shutdown()` from your own handler when the app already owns its lifecycle. Separately, `flushOnExit` (default `true`) flushes on `beforeExit`, so a script that ends on its own keeps its telemetry; it does not fire on `process.exit()` or a signal.
Backend config rule of thumb: use `endpoint` for one OTLP destination, `destinations` for explicit OTLP fan-out, and `spanProcessors` / `spanExporters` only when you need full manual control.
## Production init
```typescript
import { init } from 'autotel';
init({
service: 'checkout-api',
version: process.env.APP_VERSION,
environment: 'production',
endpoint: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
headers: { 'x-honeycomb-team': process.env.HONEYCOMB_API_KEY! },
sampling: 'production',
processHandlers: true,
});
```
- **`service`**: required. `OTEL_SERVICE_NAME` fills it when the key is left out.
- **`version`**: defaults to `version` in `package.json` in the working directory, else `'1.0.0'`.
- **`environment`**: defaults to `NODE_ENV`, else `'development'`. Sets `deployment.environment.name` (and the legacy `deployment.environment`). `'production'` also switches on PII redaction (`attributeRedactor: 'default'`) unless you pass `attributeRedactor: false` or set `AUTOTEL_REDACT_PII=off`.
- **`endpoint`**: the OTLP base URL; autotel appends `/v1/traces`, `/v1/metrics`, `/v1/logs`. Falls back to `OTEL_EXPORTER_OTLP_ENDPOINT`. With neither (and no `destinations` / exporters / processors) **nothing is exported**: there is no localhost default.
- **`headers`**: an object or a `'key=value,key2=value2'` string. Falls back to `OTEL_EXPORTER_OTLP_HEADERS`.
- **`protocol`**: `'http'` (OTLP/HTTP with a JSON body, the default), `'http/protobuf'` or `'grpc'`. The last two need the matching `@opentelemetry/exporter-*-otlp-proto` / `-grpc` packages in your app. Falls back to `OTEL_EXPORTER_OTLP_PROTOCOL`.
- **`sampling`**: set it. Without `sampling` or `sampler`, wrapped functions keep every span. See `tune-sampling`.
- **`logs`**: off by default. `logs: true` (or `AUTOTEL_LOGS=on`) exports OTel log records to the same endpoint; the HTTP/JSON log exporter ships with autotel.
- **Shutdown**: `await flush()` exports what is buffered (2s timeout by default); `await shutdown()` flushes and stops the SDK, waiting up to 10s (the top-level `init({ shutdownTimeoutMs })` or `shutdown({ timeout })` changes it). Both come from `autotel`.
- **`init()` throws** on an unknown `sampling` preset, an invalid `attributeRedactor` config, `devtools: { embedded: true, port: 0 }`, and an `sdkFactory` that returns nothing. Calling `init()` again warns, shuts the previous pipeline down and starts the new config; `trace()` wrappers, tracers from `getTracer()` and the earlier call's instrumentations follow it. `init()` after `shutdown()` starts a fresh pipeline without a warning. `lockLogger()` makes later calls no-ops.
## Setup
```typescript
import { init, withTracing, getRequestLogger } from 'autotel';
init({ service: 'my-app' });
const handler = withTracing({ name: 'http.request' })(
(ctx) => async (req: Request) => {
const log = getRequestLogger(ctx);
log.set({ path: req.url });
const result = await doWork(req);
log.emitNow();
return result;
},
);
```
## Core Patterns
**Factory pattern when you need context (attributes, request logger):**
```typescript
const createUser = withTracing({ name: 'user.create' })(
(ctx) => async (data: UserInput) => {
ctx.setAttribute('user.id', data.id);
const log = getRequestLogger(ctx);
log.set({ user: { id: data.id } });
return db.users.create(data);
},
);
```
**Direct pattern when you don't need context:**
```typescript
const getUser = trace(async (id: string) => {
return db.users.findById(id);
});
```
**One immediate named operation when you do need context:**
```typescript
const result = await trace.run('user.lookup', async (ctx) => {
ctx.setAttribute('user.id', id);
return db.users.findById(id);
});
```
**Version.** `trace.run()` needs autotel 7.0 or later. On 6.x the immediate form is `span(name, fn)`, and `trace(...)` still wraps.
**`trace` wraps, `trace.run` runs.** Every `trace(...)` form returns a wrapper
and executes nothing. For the `ctx => async () => …` factory form use
`withTracing({ name })`; autotel warns once when `trace()` is handed one. A
reusable function with an explicit name is:
```typescript
export const createUser = trace('user.create', async (data: NewUser) => {
return db.users.create(data);
});
```
Inside any traced body, import `ctx` to reach the span — it resolves at anyFrom jagreehal/autotel, Apache-2.0.
More from jagreehal/autotel
- 0.631score
find-observability-gaps
jagreehal
Scores the observability of every entry point in a codebase with `autotel map` and closes the gaps it reports.
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
build-audit-trails
jagreehal
Build or review tamper-aware audit trails on top of OpenTelemetry spans using autotel and the autotel-audit package (`withAudit`, `setAuditAttributes`…
SkillAFreshness: A★ 8Claude Code +9 - 0.626score
autotel-anti-patterns
jagreehal
Common autotel mistakes and how to fix them.
SkillAFreshness: A★ 8Claude Code +9 - 0.626score
autotel-testing
jagreehal
Test autotel instrumentation with createTraceCollector() and InMemorySpanExporter.
SkillAFreshness: A★ 8Claude Code +9 - 0.626score
migrate-to-autotel
jagreehal
Migrate an existing observability setup to autotel.
SkillAFreshness: A★ 8Claude Code +9 - 0.626score
production-observability
jagreehal
Takes a Node.js or TypeScript service to production-grade observability with autotel, in an existing codebase or a new one, and keeps it there.
SkillAFreshness: A★ 8Claude Code +9 - 0.626score
design-alertable-metrics
jagreehal
Designs metrics an alarm can actually be written against — picking the attributes that let a rule isolate one failing dependency, pinning metric names as a…
SkillAFreshness: A★ 8Claude Code +9 - 0.626score
autotel-investigate
jagreehal
Query OpenTelemetry telemetry (traces, metrics, logs, LLM analytics) via the autotel CLI.
SkillAFreshness: A★ 8Claude Code +9 - 0.626score
autotel-framework-setup
jagreehal
Set up autotel in Hono, Fastify, TanStack Start, Cloudflare Workers, Next.js, Express, MCP, and edge runtimes.
SkillAFreshness: A★ 8Claude Code +9 - 0.626score
autotel-request-logging
jagreehal
Accumulates request-scoped context and emits one wide-event snapshot per request with getRequestLogger(), set(), setLevel(), info/warn/error, and emitNow().
SkillAFreshness: A★ 8Claude Code +9 - 0.626score
autotel-structured-errors
jagreehal
Throws and parses errors that explain themselves with message, why, fix, link, and status, including reusable catalogs via defineErrorCatalog.
SkillAFreshness: A★ 8Claude Code +9 - 0.626score
debug-missing-spans
jagreehal
Troubleshoot when expected OpenTelemetry spans don't reach the backend.
SkillAFreshness: A★ 8Claude Code +9
Signals
- Stars
- 8
- Forks
- 3
- Open issues
- 0
- Last commit (this folder)
- Oct 20, 2026 (7 days ago)
- Last release
- Sep 27, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Apache-2.0
- Repository
- github.com/jagreehal/autotel
- Website
- jagreehal.github.io/autotel/
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from jagreehal
- 0.631score
build-audit-trails
jagreehal
Build or review tamper-aware audit trails on top of OpenTelemetry spans using autotel and the autotel-audit package (`withAudit`, `setAuditAttributes`…
SkillAFreshness: A★ 8Claude Code +9 - 0.631score
find-observability-gaps
jagreehal
Scores the observability of every entry point in a codebase with `autotel map` and closes the gaps it reports.
SkillAFreshness: A★ 8Claude Code +9 - 0.626score
autotel-anti-patterns
jagreehal
Common autotel mistakes and how to fix them.
SkillAFreshness: A★ 8Claude Code +9 - 0.626score
autotel-testing
jagreehal
Test autotel instrumentation with createTraceCollector() and InMemorySpanExporter.
SkillAFreshness: A★ 8Claude Code +9 - 0.626score
autotel-investigate
jagreehal
Query OpenTelemetry telemetry (traces, metrics, logs, LLM analytics) via the autotel CLI.
SkillAFreshness: A★ 8Claude Code +9 - 0.626score
analyze-traces
jagreehal
Analyze OpenTelemetry traces and structured logs from a running autotel service to debug errors, investigate latency, follow requests across services, and…
SkillAFreshness: A★ 8Claude Code +9
Cite this page
autotel-core skill. Agent Mart. https://agentmart.dev/skills/jagreehal-autotel-core (last updated 2026-10-24)