Skip to content

Deno ​

OpenTelemetry is built into Deno, so there's nothing to install. Turn it on and you get traces for Deno.serve and fetch, HTTP server metrics, and every console.log as a log.

Before you start

You need a stream and ingest key for each signal. See OpenTelemetry → Before you start. You'll also need Deno 2.4 or newer.

1. Configure ​

bash
OTEL_DENO=true
OTEL_SERVICE_NAME=checkout-api

OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://ws.latency.app/v1/telemetry/traces
OTEL_EXPORTER_OTLP_TRACES_HEADERS=authorization=Bearer%20lit_your_traces_key

OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=https://ws.latency.app/v1/telemetry/metrics
OTEL_EXPORTER_OTLP_METRICS_HEADERS=authorization=Bearer%20lit_your_metrics_key
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=delta

OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://ws.latency.app/v1/telemetry/logs
OTEL_EXPORTER_OTLP_LOGS_HEADERS=authorization=Bearer%20lit_your_logs_key

OTEL_DENO=true is the switch. Deno already sends over HTTP, so there's no protocol to set.

Deno always sends all three signals and can't turn one off, so set up a stream for each.

2. Run ​

Start your app as usual:

bash
deno run -A main.ts

3. Check it's working ​

Make a few requests to your app, then open Telemetry in the Console and pick your traces stream. Traces show up within seconds. Metrics follow within a minute.

Custom spans ​

Deno sets up @opentelemetry/api for you, so import it and go:

ts
import { trace } from "npm:@opentelemetry/api@1";

const tracer = trace.getTracer("checkout");

await tracer.startActiveSpan("charge-card", async (span) => {
  try {
    span.setAttribute("order.id", order.id);
    await chargeCard(order);
  } finally {
    span.end();
  }
});

Custom metrics ​

ts
import { metrics } from "npm:@opentelemetry/api@1";

const meter = metrics.getMeter("checkout");
const orders = meter.createCounter("orders.placed");
const duration = meter.createHistogram("checkout.duration", { unit: "ms" });

orders.add(1, { plan: "pro" });
duration.record(182, { route: "/pay" });

Logs ​

Every console.log, console.warn and console.error is sent to your logs stream, linked to the trace it happened in. It still prints to your terminal too. To send logs to Latency only, set OTEL_DENO_CONSOLE=replace, or to keep console output out of Latency, set OTEL_DENO_CONSOLE=ignore.

© 2026 Latency Labs LLC