Framework Integrations
Six frameworks across three languages. Each integration captures requests at the transport layer.
Express
expressMiddleware()must be the first middleware (beforeexpress.json(),cors(), routes)- Errors passed to
next(err)are captured via the error handler - See Node.js SDK for full setup
Next.js
- Create
instrumentation.tsin your project root (notapp/orsrc/) - Must be
async function register()withNEXT_RUNTIME === "nodejs"guard and dynamicimport() - Only
/api/*routes captured; static pages and_next/*are skipped - Requires Next.js 14+
- See Node.js SDK for full setup
FastAPI
Monitor(app, ...)must be called afterapp = FastAPI()and before route definitions- Adds HTTP middleware internally via
@app.middleware("http") - See Python SDK for full setup
Flask
Monitor(app, ...)must be called afterapp = Flask(__name__)and before route definitions- Uses
before_request,after_request, andteardown_requesthooks - See Python SDK for full setup
net/http (Go)
kohi.NetHTTPMiddleware(monitor)(mux)must be the outermost middleware- Call
monitor.Close()on shutdown - See Go SDK for full setup
fasthttp (Go)
kohi.FastHTTPMiddleware(monitor)(handler)must be the outermost handler wrapper- Call
monitor.Close()on shutdown - See Go SDK for full setup
Wizard
npx @kohicorp/wizardAuto-detects your framework from package.json, go.mod, or pyproject.toml/requirements.txt. Installs the SDK, creates .env, shows setup code. Use --local for local development.