Skip to content

All docs

Tracing

Tracing overview

A trace represents one request as it moves through your system. A span represents a single unit of work within that trace, such as a database query or an outbound HTTP call.

Spans and traces

Spans are linked by a shared trace id and a parent span id, forming a tree that mirrors the actual call graph of a request.

Instrumenting your service

npm
npm
npm
import { init } from "@publicsurface/trace"

init({
  service: "checkout-api",
  apiKey: process.env.PUBLICSURFACE_API_KEY,
})
import { init } from "@publicsurface/trace"

init({
  service: "checkout-api",
  apiKey: process.env.PUBLICSURFACE_API_KEY,
})
import { init } from "@publicsurface/trace"

init({
  service: "checkout-api",
  apiKey: process.env.PUBLICSURFACE_API_KEY,
})

Most frameworks are instrumented automatically once init() runs. Manual spans are also supported for custom work.

Control how much trace data you keep with Trace sampling rules.

Create a free website with Framer, the website builder loved by startups, designers and agencies.