observability

command
v0.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Example: observability

Demonstrates drel's production observability surface — all opt-in via Options passed to Open, plus the OnQuery hook:

  • WithLogger + WithQueryLog: structured slog line for every query.
  • WithSlowQueryThreshold: queries slower than the threshold are flagged.
  • WithTracer: one span per executed query (OpenTelemetry-style). This example plugs in a tiny in-memory tracer that counts spans.
  • WithDevMode: development-time diagnostics — here it warns about an unbounded SELECT (no LIMIT).
  • OnQuery: a raw hook receiving SQL, args, duration, and error for custom metrics/audit.

Runs against in-memory SQLite (pure-Go modernc.org/sqlite, no CGO).

Usage:

cd examples/observability
go run ../../cmd/drel generate   # generates catalog/product_drel.go + db/drel_gen.go
go run .

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL