Integrate monitoring server for observability, adding health and metrics endpoints. Update configuration to enable monitoring features and enhance README with deployment examples for Kubernetes and systemd. Refactor application initialization to include monitoring server setup and improve error handling in message processing metrics.

This commit is contained in:
windyboy
2025-11-15 16:30:29 +08:00
parent c3f98e9c7c
commit 53208997e8
17 changed files with 1092 additions and 182 deletions
+8 -2
View File
@@ -127,15 +127,21 @@ func executeListen(c *cli.Context) error {
}
// Initialize dependencies using Wire
processor, consumer, err := di.InitializeAppWithConfig(cfg)
processor, consumer, monitorServer, err := di.InitializeAppWithConfig(cfg)
if err != nil {
return fmt.Errorf("failed to initialize app: %w", err)
}
// Create context with cancellation
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
if monitorServer != nil {
if err := monitorServer.Start(ctx); err != nil {
return fmt.Errorf("failed to start monitoring server: %w", err)
}
defer monitorServer.Shutdown(context.Background())
}
// Handle graceful shutdown
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)