feat(go): add platform principles and health probes
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/segmentio/kafka-go"
|
||||
|
||||
"lingniu-vehicle-ingest/go/vehicle-gateway/internal/envelope"
|
||||
"lingniu-vehicle-ingest/go/vehicle-gateway/internal/health"
|
||||
"lingniu-vehicle-ingest/go/vehicle-gateway/internal/observability"
|
||||
)
|
||||
|
||||
@@ -32,6 +33,14 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
defer conn.Close()
|
||||
health.Start(ctx, logger, health.NewServer(env("HEALTH_ADDR", ""), "nats-kafka-bridge", []health.Check{
|
||||
{Name: "nats", Check: func(context.Context) error {
|
||||
if conn.Status() != nats.CONNECTED {
|
||||
return fmt.Errorf("nats status is %s", conn.Status().String())
|
||||
}
|
||||
return nil
|
||||
}},
|
||||
}))
|
||||
js, err := conn.JetStream()
|
||||
if err != nil {
|
||||
logger.Error("nats jetstream init failed", "error", err)
|
||||
|
||||
Reference in New Issue
Block a user