All Integrations
Languagesnpm package

Hono Integration

Instrument Hono applications with one npm install. Edge-first framework tracing for Cloudflare Workers, Deno, and Bun runtimes — zero cold-start overhead.

Setup

How It Works

01

Install the npm Package

Run npm install @tigerops/hono or add it to your wrangler.toml dependencies. The package uses the Web Fetch API and is fully compatible with Cloudflare Workers, Deno Deploy, Bun, and Node.js runtime environments.

02

Add the TigerOps Middleware

Import { tigerops } from "@tigerops/hono" and call app.use("*", tigerops()). The middleware reads trace context from incoming W3C headers and propagates it through Hono's Context object to all downstream handlers.

03

Configure via Environment Bindings

For Cloudflare Workers, set TIGEROPS_API_KEY as a secret with wrangler secret put. For Deno and Bun, use environment variables. The middleware reads from c.env (Workers) or process.env (Node/Bun) automatically.

04

Traces Across All Edge Runtimes

Within seconds TigerOps receives Hono route spans with cold start timing, runtime platform tag, geographic region, request duration, and status codes from Cloudflare Workers, Deno Deploy, and Bun edge deployments.

Capabilities

What You Get Out of the Box

Cloudflare Workers Runtime Tracing

TigerOps traces Hono routes running on Cloudflare Workers with CPU time, wall time, cold start flag, geographic colo, and request duration. Spans are flushed using ctx.waitUntil() to avoid blocking response delivery.

Deno Deploy & Bun Support

The same middleware works on Deno Deploy and Bun without modification. Runtime is auto-detected and tagged on every span. Bun.serve() and Deno.serve() are both instrumented with no additional configuration needed.

Hono Context Propagation

The active span is stored on c.get("tigerops-span") so any route handler or middleware can access and annotate it. W3C traceparent and baggage headers are read from incoming requests and injected into fetch() calls via a patched fetch wrapper.

Route Pattern Attribution

Hono route patterns including named parameters (:id), wildcards, and grouped routes are extracted and attached to spans as http.route. Raw URL paths with dynamic segments are never stored, preventing high-cardinality trace explosion.

Edge Cache & KV Monitoring

Cloudflare Cache API reads and writes are traced as child spans with cache hit/miss status and key prefix. Workers KV get, put, and list operations are instrumented with namespace, key (hashed), and operation latency.

Streaming Response Tracing

Hono streaming responses using streamText() and streamSSE() are traced end-to-end. The span covers the full stream duration with chunk count, first byte time, and total bytes emitted as span attributes.

Configuration

Install & Initialize

One npm install. One middleware use. Edge-native Hono observability.

terminal + worker.ts
# Install the TigerOps Hono package
npm install @tigerops/hono

# For Cloudflare Workers — set secret
wrangler secret put TIGEROPS_API_KEY

# wrangler.toml
[vars]
TIGEROPS_SERVICE_NAME = "my-hono-worker"
TIGEROPS_ENVIRONMENT = "production"

// worker.ts
import { Hono } from 'hono'
import { tigerops } from '@tigerops/hono'

type Env = {
  TIGEROPS_API_KEY: string
  TIGEROPS_SERVICE_NAME: string
}

const app = new Hono<{ Bindings: Env }>()

// Register TigerOps middleware globally
app.use('*', tigerops())

app.get('/users/:id', async (c) => {
  // Access active span via context
  const span = c.get('tigerops-span')
  span?.setAttribute('user.id', c.req.param('id'))

  const user = await fetchUser(c.req.param('id'))
  return c.json(user)
})

app.post('/orders', async (c) => {
  const body = await c.req.json()
  const span = c.get('tigerops-span')
  span?.setAttribute('order.items', body.items.length)

  const order = await createOrder(body)
  return c.json(order, 201)
})

export default app
FAQ

Common Questions

Does TigerOps work with Hono RPC and hono/client?

Yes. hono/client fetch calls are intercepted and have traceparent headers injected automatically. The server-side RPC handler creates a child span linked to the client call, enabling end-to-end trace correlation across RPC boundaries.

How are spans exported from Cloudflare Workers without blocking responses?

TigerOps batches span exports and submits them via ctx.waitUntil(exporter.flush()). This runs after the response is sent and does not add latency to the response path. The Workers CPU time budget is not consumed by span export.

Can I use TigerOps with Hono on Node.js using @hono/node-server?

Yes. The @tigerops/hono package detects the @hono/node-server runtime and switches to a Node.js-compatible OTLP exporter over HTTP. Node.js runtime metrics (heap, event loop lag) are collected in addition to Hono route spans.

How do I instrument Durable Objects called from a Hono route?

Add the tigerops-durable-objects package and wrap your Durable Object fetch method with tigerops.instrumentDurableObject(). The span is linked to the originating Hono route span via trace context forwarded in the stub fetch headers.

Does TigerOps support Hono middleware stacks on multiple routes?

Yes. Use app.use("/api/*", tigerops()) to scope tracing to specific route prefixes. Each route group can have different sampling rates configured via the sampleRate option passed to the tigerops() middleware factory.

Get Started

Full Hono Observability Across Every Edge Runtime

Route traces, cold start timing, edge cache monitoring, and streaming response spans — no code changes required.