Runtime model
Layeron treats an observability stream as part of the app model.
Declaration Flow
Section titled “Declaration Flow”observability(...) -> app.use(...) -> AppSpec -> RuntimeTopology -> Worker observability settings -> runtime sinkThe declaration starts in application code. Layeron records it in the app spec and includes it in the compiled runtime plan.
Runtime Attachment
Section titled “Runtime Attachment”Layeron attaches the stream before route handlers run.
After attachment, route code can call methods such as increment(...),
timing(...), event(...), and capture(...).
A route that calls the stream before runtime attachment receives an
observability runtime is not attached error.
span(...) emits a span record after the callback finishes.
Nested spans receive a parentSpanId. Failed spans use outcome error and
also capture the thrown error.
Current Cloudflare Target
Section titled “Current Cloudflare Target”The current Cloudflare target uses Cloudflare Workers Logs as the sink.
Layeron enables Worker observability settings during compile and deploy when an app or product declares observability.
Local Tests
Section titled “Local Tests”Tests can provide an observabilitySink and inspect emitted records directly.
Use this for unit tests that need to verify counters, events, signals, timings, or captured errors.