Marketplace

observability

Other

togo observability — request inspector, error tracking, logs, health & metrics

togo-framework
bash
togo install togo-framework/observability

Install

bash
togo install togo-framework/observability

A lightweight, app-internal Telescope / Pulse for togo: see every request, group your errors, capture structured logs, expose health endpoints, and read latency/error metrics — all from inside your app, no external service required.

What you get

  • Request inspector — middleware records method, path, status, duration and IP for every request.
  • Error trackingCaptureError groups exceptions by fingerprint into Issues (count, first/last seen); a panic-recovery middleware turns crashes into captured errors + a clean 500.
  • Log capture — a slog.Handler records structured logs, queryable by level.
  • Health — register readiness checks; serve /healthz (liveness) and /readyz (readiness → 503 when degraded).
  • Metrics — request count, error rate, p50/p95 latency, and slowest endpoints.

Everything lives in bounded in-memory ring buffers (with a seam for a durable store) and is exposed over a Go API + REST at /api/observability/*.

Usage

go
o, _ := observability.FromKernel(k)

// Inspect requests + capture panics.
router.Use(o.Middleware)
router.Use(o.Recover)

// Capture structured logs.
slog.SetDefault(slog.New(o.SlogHandler(slog.LevelInfo)))

// Capture handled errors with context.
if err := charge(ctx, order); err != nil {
    o.CaptureError(ctx, err, map[string]any{"order_id": order.ID})
}

// Readiness checks for your dependencies.
o.RegisterCheck("db",    func(ctx context.Context) error { return db.PingContext(ctx) })
o.RegisterCheck("cache", func(ctx context.Context) error { return cache.Ping(ctx) })

Read it back:

go
o.Requests()        // recent requests
o.Issues()          // error groups; o.Events(fingerprint) for the events
o.Logs("ERROR")     // captured logs, filtered by level
o.Health(ctx)       // ok | degraded + per-check status
o.Metrics()         // requests, error_rate, p50/p95, slowest endpoints

REST

Method
Path
Returns
GET/api/observability/requestsrecent requests
GET/api/observability/issueserror groups
GET/api/observability/issues/{fp}/eventsevents for an issue
GET/api/observability/logs?level=ERRORcaptured logs
GET/api/observability/metricsmetrics summary
GET/api/observability/healthhealth detail
GET/healthz · /readyzliveness · readiness (503 if degraded)
Rows per page
1–7 of 7
Page 1 of 1

Configuration

No required env. Stores default to ~1000-entry ring buffers; replace the store seam with a durable backend for long retention or multi-instance aggregation.


<div align="center"> <h3>Premium sponsors</h3> <p> <a href="https://id8media.com"><strong>ID8 Media</strong></a> &nbsp;·&nbsp; <a href="https://one-studio.co"><strong>One Studio</strong></a> </p> <p><sub>Support togo — <a href="https://github.com/sponsors/fadymondy">become a sponsor</a>.</sub></p> </div>