25 · Integrations
Apitally — or use webLogger and forge/trace
Built-in webLogger() covers basics; forge/trace gives OpenTelemetry-compatible distributed tracing. Both work alongside any 3rd-party APM.
Code
apitally.js
const { WebApp, webLogger } = require(class="tk-str">39;@hyperbridge/forge/server39;); const { tracer } = require(class="tk-str">39;@hyperbridge/forge/trace39;); const app = new WebApp(); class="tk-cm">// Built-in request logger app.use(class="tk-str">39;*39;, webLogger()); class="tk-cm">// Custom metrics middleware — send to any APM app.use(class="tk-str">39;*39;, async (c, next) => { const span = tracer.startSpan(class="tk-str">39;http.request39;); span.setAttribute(class="tk-str">39;http.method39;, c.req.method); span.setAttribute(class="tk-str">39;http.path39;, c.req.path); await next(); span.setAttribute(class="tk-str">39;http.status39;, c.res?.status ?? 0); span.end(); }); app.get(class="tk-str">39;/health39;, (c) => c.json({ ok: true })); app.listen(3000);
How it works
webLogger() emits one line per request — method, path, status, duration. Configure with { write: fn } to ship to your log aggregator.
forge/trace emits W3C Trace Context-compatible spans, exportable to Jaeger, Tempo, Honeycomb, or any OTLP backend.
For Apitally specifically, drop their npm package in alongside — it reads from the same Fetch Response object WebApp produces.
Try it
Quickstart
npm i @hyperbridge/forge && app.use('*', webLogger())
Related modules
This is HBForge's port of Hono's example. Read the original at hono.dev/examples/apitally.