From ea53e42de9071fe0ce944d65c776b1ec032fdcc8 Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Tue, 13 Feb 2024 18:55:32 -0600 Subject: [PATCH] core/web: improve health CLI readabilty (#12021) --- core/web/health_controller.go | 6 +-- core/web/testdata/body/health.txt | 38 +++++++++---------- core/web/testdata/health.txt | 18 ++++----- testdata/scripts/health/default.txtar | 16 ++++---- testdata/scripts/health/multi-chain.txtar | 46 +++++++++++------------ 5 files changed, 62 insertions(+), 62 deletions(-) diff --git a/core/web/health_controller.go b/core/web/health_controller.go index 7ab07291b58..bd775671d73 100644 --- a/core/web/health_controller.go +++ b/core/web/health_controller.go @@ -125,12 +125,12 @@ func (hc *HealthController) Health(c *gin.Context) { func writeTextTo(w io.Writer, checks []presenters.Check) error { slices.SortFunc(checks, presenters.CmpCheckName) for _, ch := range checks { - status := "?" + status := "? " switch ch.Status { case HealthStatusPassing: - status = "-" + status = "ok " case HealthStatusFailing: - status = "!" + status = "! " } if _, err := fmt.Fprintf(w, "%s%s\n", status, ch.Name); err != nil { return err diff --git a/core/web/testdata/body/health.txt b/core/web/testdata/body/health.txt index 59f63c26413..03a78c22c28 100644 --- a/core/web/testdata/body/health.txt +++ b/core/web/testdata/body/health.txt @@ -1,20 +1,20 @@ --EVM.0 --EVM.0.BalanceMonitor --EVM.0.HeadBroadcaster --EVM.0.HeadTracker -!EVM.0.HeadTracker.HeadListener +ok EVM.0 +ok EVM.0.BalanceMonitor +ok EVM.0.HeadBroadcaster +ok EVM.0.HeadTracker +! EVM.0.HeadTracker.HeadListener Listener is not connected --EVM.0.LogBroadcaster --EVM.0.Txm --EVM.0.Txm.BlockHistoryEstimator --EVM.0.Txm.Broadcaster --EVM.0.Txm.Confirmer --EVM.0.Txm.WrappedEvmEstimator --JobSpawner --Mailbox.Monitor --Mercury.WSRPCPool --Mercury.WSRPCPool.CacheSet --PipelineORM --PipelineRunner --PromReporter --TelemetryManager +ok EVM.0.LogBroadcaster +ok EVM.0.Txm +ok EVM.0.Txm.BlockHistoryEstimator +ok EVM.0.Txm.Broadcaster +ok EVM.0.Txm.Confirmer +ok EVM.0.Txm.WrappedEvmEstimator +ok JobSpawner +ok Mailbox.Monitor +ok Mercury.WSRPCPool +ok Mercury.WSRPCPool.CacheSet +ok PipelineORM +ok PipelineRunner +ok PromReporter +ok TelemetryManager diff --git a/core/web/testdata/health.txt b/core/web/testdata/health.txt index f155d6c0212..89882cc1159 100644 --- a/core/web/testdata/health.txt +++ b/core/web/testdata/health.txt @@ -1,15 +1,15 @@ --foo -!foo.bar +ok foo +! foo.bar example error message --foo.bar.1 --foo.bar.1.A --foo.bar.1.B -!foo.bar.2 +ok foo.bar.1 +ok foo.bar.1.A +ok foo.bar.1.B +! foo.bar.2 error: this is a multi-line error: new line: original error -!foo.bar.2.A +! foo.bar.2.A failure! --foo.bar.2.B --foo.baz +ok foo.bar.2.B +ok foo.baz diff --git a/testdata/scripts/health/default.txtar b/testdata/scripts/health/default.txtar index 15be9da1fe6..4ca7fba9254 100644 --- a/testdata/scripts/health/default.txtar +++ b/testdata/scripts/health/default.txtar @@ -31,14 +31,14 @@ fj293fbBnlQ!f9vNs HTTPPort = $PORT -- out.txt -- --JobSpawner --Mailbox.Monitor --Mercury.WSRPCPool --Mercury.WSRPCPool.CacheSet --PipelineORM --PipelineRunner --PromReporter --TelemetryManager +ok JobSpawner +ok Mailbox.Monitor +ok Mercury.WSRPCPool +ok Mercury.WSRPCPool.CacheSet +ok PipelineORM +ok PipelineRunner +ok PromReporter +ok TelemetryManager -- out.json -- { diff --git a/testdata/scripts/health/multi-chain.txtar b/testdata/scripts/health/multi-chain.txtar index 6a6adb895cb..112d9e3cdb1 100644 --- a/testdata/scripts/health/multi-chain.txtar +++ b/testdata/scripts/health/multi-chain.txtar @@ -60,30 +60,30 @@ Name = 'primary' URL = 'http://stark.node' -- out.txt -- --Cosmos.Foo.Chain --Cosmos.Foo.Txm --EVM.1 --EVM.1.BalanceMonitor --EVM.1.HeadBroadcaster --EVM.1.HeadTracker -!EVM.1.HeadTracker.HeadListener +ok Cosmos.Foo.Chain +ok Cosmos.Foo.Txm +ok EVM.1 +ok EVM.1.BalanceMonitor +ok EVM.1.HeadBroadcaster +ok EVM.1.HeadTracker +! EVM.1.HeadTracker.HeadListener Listener is not connected --EVM.1.LogBroadcaster --EVM.1.Txm --EVM.1.Txm.BlockHistoryEstimator --EVM.1.Txm.Broadcaster --EVM.1.Txm.Confirmer --EVM.1.Txm.WrappedEvmEstimator --JobSpawner --Mailbox.Monitor --Mercury.WSRPCPool --Mercury.WSRPCPool.CacheSet --PipelineORM --PipelineRunner --PromReporter --Solana.Bar --StarkNet.Baz --TelemetryManager +ok EVM.1.LogBroadcaster +ok EVM.1.Txm +ok EVM.1.Txm.BlockHistoryEstimator +ok EVM.1.Txm.Broadcaster +ok EVM.1.Txm.Confirmer +ok EVM.1.Txm.WrappedEvmEstimator +ok JobSpawner +ok Mailbox.Monitor +ok Mercury.WSRPCPool +ok Mercury.WSRPCPool.CacheSet +ok PipelineORM +ok PipelineRunner +ok PromReporter +ok Solana.Bar +ok StarkNet.Baz +ok TelemetryManager -- out.json -- {