Core concepts
Observability has four concepts: stream identity, records, context, and attributes.
Stream Identity
Section titled “Stream Identity”Every stream uses Layeron’s platform namespace/name identity:
const runtime = observability({ namespace: "api", name: "runtime",})The example identity is api/runtime. See Namespaces for
platform namespace defaults and naming rules.
Examples:
| Namespace | Name | Good For |
|---|---|---|
api | runtime | Route counts, latency, and errors. |
api | database | Query latency and database events. |
webhooks | stripe | Delivery attempts, retries, and replay events. |
jobs | email | Queue depth, job duration, and failures. |
Records
Section titled “Records”A record is one emitted observability fact.
Examples:
- A counter named
posts.list.requests. - A timing named
posts.list.duration_ms. - An event named
posts.created. - An error captured from a failed handler.
Context
Section titled “Context”Layeron adds context when it is available:
projectIdenvironmentIddeploymentIdrequestIdtraceIdmoduleIdrouteIdresourceLogicalId
Context helps connect a record to the request, route, module, environment, or deployment that produced it.
Attributes
Section titled “Attributes”Attributes are extra fields that you pass with a record:
runtime.increment("webhooks.stripe.deliveries", 1, { provider: "stripe", route: "/webhooks/stripe",})Use attributes for values that make filtering useful, such as route, provider, tenant, status, shard, or queue name.
The current sink is worker_logs.
It emits structured records through Cloudflare Workers Logs.