Refactor telemetry and metrics handling to enhance observability. Remove TLS configuration from telemetry initialization, replacing it with an insecure option for HTTP. Update OpenTelemetry endpoint handling to normalize URLs. Introduce new metrics for publish failures categorized by message type. Enhance Grafana dashboards with detailed descriptions and additional metrics for better monitoring insights. Update documentation to reflect changes in metrics and observability features.

This commit is contained in:
windyboy
2025-11-19 14:53:58 +08:00
parent c687fdcde8
commit f01dd3bf1f
13 changed files with 224 additions and 238 deletions
+8 -1
View File
@@ -72,7 +72,14 @@ func ProvideNATSConn(cfg *config.Config, logger *zap.Logger) (*nats.Conn, error)
}
// ProvideJetStream creates a JetStream context from a NATS connection.
func ProvideJetStream(nc *nats.Conn, logger *zap.Logger) (nats.JetStreamContext, error) {
// Returns nil when mode is "core" to indicate JetStream should not be used.
func ProvideJetStream(nc *nats.Conn, cfg *config.Config, logger *zap.Logger) (nats.JetStreamContext, error) {
// In core mode, return nil so that publishers/consumers use core NATS
if cfg.NATS.Mode == "core" {
logger.Debug("Skipping JetStream initialization (core mode)")
return nil, nil
}
js, err := nc.JetStream()
if err != nil {
logger.Error("failed to create JetStream context", zap.Error(err))