Problem
There is no centralized request-level observability in Penny. Any logging or timing must be added inside individual handlers, leading to duplication or inconsistency. Gadget already tracks correlation IDs and request latency internally, but consumers have no way to hook into the pipeline.
What changes
Once Gadget supports middleware, register a logging/metrics middleware in cmd/server.go:
myBot.Use(func(next gadget.HandlerFunc) gadget.HandlerFunc {
return func(ctx gadget.HandlerContext, ...) {
start := time.Now()
log.Info().Str("route", ctx.Route.Name).Msg("handling event")
next(ctx, ...)
log.Info().Dur("duration", time.Since(start)).Msg("done")
}
})
This would provide consistent request logging across all handlers without modifying handler code.
Blocked by
Files affected
cmd/server.go — register middleware after SetupWithConfig
Problem
There is no centralized request-level observability in Penny. Any logging or timing must be added inside individual handlers, leading to duplication or inconsistency. Gadget already tracks correlation IDs and request latency internally, but consumers have no way to hook into the pipeline.
What changes
Once Gadget supports middleware, register a logging/metrics middleware in
cmd/server.go:This would provide consistent request logging across all handlers without modifying handler code.
Blocked by
Files affected
cmd/server.go— register middleware afterSetupWithConfig