Skip to content

Commit

Permalink
core/web: improve health CLI readabilty (smartcontractkit#12021)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 authored Feb 14, 2024
1 parent 1d0f9ec commit ea53e42
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 62 deletions.
6 changes: 3 additions & 3 deletions core/web/health_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 19 additions & 19 deletions core/web/testdata/body/health.txt
Original file line number Diff line number Diff line change
@@ -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
18 changes: 9 additions & 9 deletions core/web/testdata/health.txt
Original file line number Diff line number Diff line change
@@ -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
16 changes: 8 additions & 8 deletions testdata/scripts/health/default.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -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 --
{
Expand Down
46 changes: 23 additions & 23 deletions testdata/scripts/health/multi-chain.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -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 --
{
Expand Down

0 comments on commit ea53e42

Please sign in to comment.