Overview
Layeron Observability (observability) records structured runtime facts from
your backend app.
Use it for values that you want to count, group, or filter. Use log for
messages that a person reads while debugging.
import { backend } from "@layeron/core"import { observability } from "@layeron/modules"
const app = backend()
const runtime = observability({ name: "runtime", namespace: "api",})
app.use(runtime)
app.get("/posts", async () => { runtime.increment("posts.list.requests")
const posts = await runtime.timing("posts.list.duration_ms", () => { return listPosts() })
return Response.json({ posts })})The stream identity is api/runtime.
What Observability Records
Section titled “What Observability Records”- Request counts.
- Operation duration.
- Queue depth.
- Workflow or webhook events.
- Operational signals.
- Errors with structured attributes.
When To Add It
Section titled “When To Add It”Add observability when a record answers an operational question:
| Question | Record |
|---|---|
| How often did this route run? | Counter |
| How long did this operation take? | Timing |
| How many jobs are waiting? | Gauge |
| Did this activity happen? | Event |
| Which request produced this failure? | Error capture |
Documentation
Section titled “Documentation”- Getting started: Add a stream and emit records from a route.
- Core concepts: Learn stream identity, context, attributes, and sinks.
- Record types: Choose counters, gauges, histograms, timings, events, signals, errors, or spans.
- Sampling and redaction: Control volume and remove sensitive attributes.
- Runtime model: Understand the current Cloudflare runtime target.
- API reference: Review the
observabilitymodule contract.