Debug Actuator
pkg/debug/actuator mounts a Spring-Actuator-equivalent introspection surface — modules, startup timing, routes, health, build info, config, pprof, expvar, goroutine dump, DI graph, and live log-level control — on its own private loopback SyncModule listener. Every dependency is optional, so an absent source makes its endpoint return 501 rather than fail boot.
The module is disabled by default and binds to 127.0.0.1:6060. Enable it via config or WithEnabled:
lakta.NewRuntime( config.NewModule( config.WithConfigDirs(".", "./config"), config.WithArgs(os.Args[1:]), ), tint.NewModule(), slog.NewModule(), otel.NewModule(), health.NewModule(), actuator.NewModule( actuator.WithEnabled(true), ),)Sources such as *lakta.RuntimeInfo, *health.Health, *koanf.Koanf, the routes registry, and the slog LevelController are resolved from DI during Init. Whatever is present is exposed; whatever is missing degrades gracefully.
Endpoints
Section titled “Endpoints”All paths are relative to BasePath (default /debug). Endpoints marked with auth require the WithAuth middleware to pass — see Production hardening.
| Path | Auth | Description |
|---|---|---|
GET /modules |
Module metadata: init order, provides/requires, lifecycle, state | |
GET /startup |
Init waterfall with per-module and total durations | |
GET /config |
Config values (redacted); add ?provenance=1 for key origins |
|
GET /routes |
Registered routes across all fiber instances | |
GET /info |
Build info: Go version, main module, dependency versions | |
GET /health |
Delegates to the health module handler | |
GET /di |
DI graph; ?format=mermaid (default) or ?format=dot |
|
GET /goroutine |
✓ | Full goroutine stack dump |
GET /vars |
✓ | expvar published variables |
GET /pprof/* |
✓ | Standard net/http/pprof surface (index, profile, trace, symbol) |
POST /loggers |
✓ | Set the default log level: debug, info, warn, or error |
The /vars, /pprof, and /loggers groups can be toggled off entirely via the endpoints config block.
Production hardening
Section titled “Production hardening”This module exposes sensitive runtime internals, so its defaults are fail-closed:
- Disabled by default —
enabledisfalseuntil you opt in. - Loopback-bound — binds
127.0.0.1by default; localhost-only is not sufficient safety inside a container. - Sensitive endpoints always require auth —
/goroutine,/vars,/pprof/*, and/loggersare gated on every bind, including loopback. WithoutWithAuth, they reject all requests with401. - Non-loopback refuses to start without auth — binding a public address without
WithAuthfails boot. Setallow_insecure: trueto downgrade the refusal to a warning (sensitive endpoints still reject). - Values masked by default —
show_values: neverrenders matched config leaves as******. Choosealwaysorwhen_authorized, and extend the redaction key set withredact_patterns. - pprof duration cap — a
?seconds=above 30 on/pprof/profileand/pprof/traceis rejected to close the unbounded-CPU-profile DoS vector.
actuator.NewModule( actuator.WithEnabled(true), actuator.WithAuth(myJWTMiddleware), // fiber.Handler gating sensitive endpoints)Use WithMount to serve the endpoints under an existing fiber router instead of a private listener — an escape hatch that inherits the host router’s own middleware and exposure.
Configuration Reference
Section titled “Configuration Reference”Config path: modules.debug.actuator.<name>
enabledenabled gates the whole module; when false Init/Start are no-ops. Default false
LAKTA_MODULES__DEBUG__ACTUATOR__<NAME>__ENABLEDhosthost to bind the private actuator listener. Default 127.0.0.1
LAKTA_MODULES__DEBUG__ACTUATOR__<NAME>__HOSTportport to bind. Default 6060
LAKTA_MODULES__DEBUG__ACTUATOR__<NAME>__PORTbase_pathbasePath prefixes every endpoint. Default /debug
LAKTA_MODULES__DEBUG__ACTUATOR__<NAME>__BASE_PATHshow_valuesshowValues controls config-value masking: never|always|when_authorized
LAKTA_MODULES__DEBUG__ACTUATOR__<NAME>__SHOW_VALUESredact_patternsredactPatterns extends (does not replace) the default key-redaction set
LAKTA_MODULES__DEBUG__ACTUATOR__<NAME>__REDACT_PATTERNSendpointsendpoints toggles optional endpoint groups. All default trueendpoints.pprofLAKTA_MODULES__DEBUG__ACTUATOR__<NAME>__ENDPOINTS__PPROFendpoints.expvarLAKTA_MODULES__DEBUG__ACTUATOR__<NAME>__ENDPOINTS__EXPVARendpoints.uiLAKTA_MODULES__DEBUG__ACTUATOR__<NAME>__ENDPOINTS__UIendpoints.loggersLAKTA_MODULES__DEBUG__ACTUATOR__<NAME>__ENDPOINTS__LOGGERSallow_insecureallowInsecure downgrades the fail-closed security refusals (non-loopback
LAKTA_MODULES__DEBUG__ACTUATOR__<NAME>__ALLOW_INSECURECode-only options
Section titled “Code-only options”These options can only be set in Go code via With*() functions, not via config files or environment variables.
| Option | Type | Description |
|---|---|---|
WithMount(...) | fiber.Router | mounts endpoints under the caller's router instead of a private |
WithAuth(...) | | sets the auth middleware gating sensitive endpoints (code-only) |