Skip to content

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.

Terminal window
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.

  • Request counts.
  • Operation duration.
  • Queue depth.
  • Workflow or webhook events.
  • Operational signals.
  • Errors with structured attributes.

Add observability when a record answers an operational question:

QuestionRecord
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