autotel-request-logging
Accumulates request-scoped context and emits one wide-event snapshot per request with getRequestLogger(), set(), setLevel(), info/warn/error, and emitNow().
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-request-logging
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
Use cases: data
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-request-logging
What's inside
- Skill name
autotel-request-logging- Description
- Accumulates request-scoped context and emits one wide-event snapshot per request with getRequestLogger(), set(), setLevel(), info/warn/error, and emitNow(). Use this skill when adding request-scoped attributes, building canonical log lines, or replacing scattered console.log. Do not use for product and analytics events — use skill autotel-events — or for span creation itself, which skill autotel-instrumentation covers.
- License
- Apache-2.0
- Instructions
- 132 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Autotel: Request Logging
This skill builds on autotel-instrumentation. Read it first for init and span creation.
Accumulate context with `getRequestLogger(ctx)`, `.set()`, and `.info()`/`.warn()`/`.error()`. Call `.emitNow()` (or rely on middleware) to emit one snapshot per request. Request logger requires an active span. Use inside `trace()` or framework middleware.
Preferred event model: treat request logger emissions as the default way to capture request-correlated events in new code. If a backend still expects span-event rendering, keep compatibility at export/processor level rather than adding new `span.addEvent()` calls in application code.
## Setup
```typescript
import { init, withTracing, getRequestLogger } from 'autotel';
init({ service: 'my-app' });
const handler = withTracing({ name: 'http.request' })(
(ctx) => async (req: Request, res: Response) => {
const log = getRequestLogger(ctx);
log.set({ method: req.method, path: req.url });
const user = await getAuth(req);
log.set({ user: { id: user.id } });
const result = await doWork(req);
log.set({ result: { id: result.id } });
log.emitNow();
return res.json(result);
},
);
```
When the framework creates the span (e.g. Hono's `otel()` middleware), call `getRequestLogger()` with no args:
```typescript
import { otel } from 'autotel-hono';
app.use('*', otel());
app.get('/api/users', (c) => {
const log = getRequestLogger();
log.set({ route: 'users' });
log.emitNow();
return c.json({ users: [] });
});
```
Adapters that emit for you (`autotelMiddleware()` from `autotel-adapters/hono`, `withAutotel()` from `autotel-adapters/express` / `fastify`, …) own the request logger: read it with the adapter's `useLogger()`, and don't call `emitNow()` yourself. See `autotel-frameworks`.
## Correlate pino / winston logs with traces
The request logger is autotel's own wide event. To get `trace_id` / `span_id` on your existing app logs, and export them as OTel log records, instrument the logger library:
```typescript
// instrumentation.ts, loaded first (ESM: node --import autotel/register)
import { init } from 'autotel';
init({
service: 'api',
endpoint: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
autoInstrumentations: ['http', 'pino'], // or 'winston'
logs: true, // OTLP log export; off by default
});
// logger.ts: its own module, imported after instrumentation.ts
import pino from 'pino';
export const logger = pino();
```
- `autoInstrumentations` needs `@opentelemetry/auto-instrumentations-node` installed, and patches pino as it loads, so the logger must be created after `init()`. `init()` warns if pino / winston were already loaded.
- Winston needs `@opentelemetry/winston-transport` installed to export log records over OTLP.
- `init({ logger })` is not this: that logger only receives autotel's own diagnostics.
## Core Patterns
**Accumulate then emit:**
```typescript
const log = getRequestLogger(ctx);
log.set({ cart: { items: body.items.length } });
log.set({ payment: { method: body.method } });
log.error(err, { step: 'payment' });
log.emitNow();
```
**Set severity without logging:** `.warn()` and `.error()` set `autotel.log.level` for you. Use `setLevel()` when the request degraded but there is nothing to log, or when a warning should not colour the whole snapshot.
```typescript
if (inventory.stale) log.setLevel('warn'); // served from a stale cache
```
Takes `'debug' | 'info' | 'warn' | 'error'`. Adds no log event and records no exception. An explicit level wins: a later `.warn()` / `.error()` leaves it alone. Ignored after `emitNow()`.
**RequestLogSnapshot:** `emitNow()` returns `{ timestamp, traceId, spanId, correlationId, context }`. You can pass `onEmit` in options to forward it.
**Options:** `getRequestLogger(ctx?, { onEmit?: (snapshot) => void })` for custom fan-out on emit.
## Common Mistakes
### HIGH Call getRequestLogger() outside a span
Wrong:
```typescript
function helper() {
const log = getRequestLogger();
log.set({ step: 'helper' });
}
```
Correct:
```typescript
// Ensure helper runs inside trace() or middleware-created span
function helper(ctx?: TraceContext) {
const log = getRequestLogger(ctx);
log.set({ step: 'helper' });
}
```
Request logger attaches to the active span. If there is no active span, it throws. Wrap the call path with `trace()` or register middleware that creates a span per request.From 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
autotel-core
jagreehal
Explains when to reach for trace vs span vs request logger vs events in Autotel, and the package exports each lives behind.
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
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 - 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-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 19, 2026 (8 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
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
autotel-core
jagreehal
Explains when to reach for trace vs span vs request logger vs events in Autotel, and the package exports each lives behind.
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
Cite this page
autotel-request-logging skill. Agent Mart. https://agentmart.dev/skills/jagreehal-autotel-request-logging (last updated 2026-10-24)