Zero-config Debugging with Deno and OpenTelemetry
Deno's built-in OpenTelemetry support (enabled with --unstable-otel) automatically correlates console.log output with trace IDs, creates spans for incoming and outgoing HTTP requests, propagates W3C tracecontext headers across services, and records request-count and latency metrics by status code, all without code changes. The walkthrough shows why interleaved logs need request correlation and how spans and parent span IDs build a trace. It provides a withSpan helper around startActiveSpan for adding custom spans such as database calls, and contrasts automatic propagation with manually injecting traceparent headers.
Related posts
- How to get deep traces in your Node.js backend with OTel and Deno
Deno mediumAdeptRunning an unmodified Node.js Express server under Deno 2.2+ with the `--unstable-otel` flag yields OpenTelemetry traces and span-correlated logs with no code changes. Deno auto-instruments `console.log`, `fetch` and `Deno.serve()`. The comparison is a small ChatGPT-backed chat app viewed in Grafana's otel-lgtm Docker stack (Tempo for traces). The plain-Node route needed eight @opentelemetry dependencies, an 84-line telemetry.js configuring NodeSDK exporters and HTTP instrumentation, and a custom logger that attaches trace IDs. In Deno, a few environment variables are enough, though the feature is still experimental.
- Build a dinosaur runner game with Deno, pt. 6
Deno mediumAdeptThe final stage of the Deno dinosaur runner series adds observability using Deno Deploy's built-in logs, traces and metrics dashboards. A logging middleware emits one structured JSON line per HTTP request, and route handlers log business events like score submissions and customization saves. Custom OpenTelemetry spans wrap the leaderboard, score submission and customization routes, carrying attributes, events and recorded exceptions. Platform metrics (status codes, latency, CPU, memory, GC time, bandwidth) are used to spot anomalies before drilling into traces, and the `--tunnel` flag sends local telemetry to the same dashboards for verification before deploying.
- Observability as a superpower
incident.io mediumAdeptDistributed tracing with OpenTelemetry lets incident.io engineers spot bugs before customers report them, by showing each request's route as a tree of timed spans that exposes slow steps, N+1 queries and duplicate calls. The team gets spans for free from instrumented database and HTTP clients, follows a consistent span naming convention, and tags spans with metadata such as table names, row counts, query fingerprints and org IDs. In Go, an internal library plus a defer-with-named-return pattern records errors on spans automatically. Traces go to Cloud Trace locally and to Grafana Tempo in production, where TraceQL queries power debugging. Trace URLs are threaded into logs, Sentry errors and response headers, with a caution that span and attribute volume drives storage cost.
- Deno 2.2: OpenTelemetry, Lint Plugins, node:sqlite
Deno mediumAdeptDeno 2.2 adds built-in OpenTelemetry that auto-instruments console.log, Deno.serve and fetch and exports to an OTLP endpoint behind the --unstable-otel flag. It also adds an ESLint-like JavaScript lint plugin API with visitor and CSS-selector syntax, 15 new JSX/React lint rules, and support for node:sqlite. Other changes include JSDoc @import support and per-workspace compilerOptions in deno check, 5-20x faster LSP completions, wildcard and command-less tasks, interactive deno outdated, smaller and faster deno compile output, explicit warmup and n options for deno bench, WebTransport/QUIC APIs, and upgrades to TypeScript 5.7 and V8 13.4.
- OpenTelemetry for JavaScript Observability at Zalando
Zalando Engineering mediumAdeptZalando built thin OpenTelemetry-based observability SDKs for Node.js and the browser, sharing a common API package so isomorphic apps can be instrumented consistently. The Node.js SDK autoconfigures from Kubernetes environment variables and ships default runtime metrics (CPU, memory, GC, event loop lag) plus opt-in HTTP/Express instrumentation. The browser SDK was trimmed to about 30 KB by cherry-picking packages and lazy-loading the rest. It exports telemetry via sendBeacon through the Skipper edge proxy, gated on GDPR consent, and is exposed to frontend developers through Rendering Engine renderer APIs. Key lessons include avoiding OpenTelemetry context (Zone.js in browsers, and migration friction from OpenTracing) in favour of passing spans manually, and defining custom histogram buckets so Core Web Vitals such as LCP and CLS get meaningful percentiles.