Skip to content

Commit

Permalink
core/services/relay/evm/mercury/wsrpc: forward health and readiness f…
Browse files Browse the repository at this point in the history
…rom CacheSet (#11592)
  • Loading branch information
jmank88 authored Dec 20, 2023
1 parent 14d5d3b commit fbe25a2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
5 changes: 3 additions & 2 deletions core/services/relay/evm/mercury/wsrpc/cache/cache_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ func (cs *cacheSet) HealthReport() map[string]error {
cs.Name(): cs.Ready(),
}
cs.RLock()
defer cs.RUnlock()
for _, c := range cs.caches {
caches := maps.Values(cs.caches)
cs.RUnlock()
for _, c := range caches {
services.CopyHealth(report, c.HealthReport())
}
return report
Expand Down
7 changes: 4 additions & 3 deletions core/services/relay/evm/mercury/wsrpc/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"sync"

"github.com/smartcontractkit/wsrpc/credentials"
"golang.org/x/exp/maps"

"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services"
Expand Down Expand Up @@ -224,7 +225,7 @@ func (p *pool) Ready() error {
}

func (p *pool) HealthReport() map[string]error {
return map[string]error{
p.Name(): p.Ready(),
}
hp := map[string]error{p.Name(): p.Ready()}
maps.Copy(hp, p.cacheSet.HealthReport())
return hp
}
5 changes: 4 additions & 1 deletion core/web/testdata/body/health.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@
<details open>
<summary title=""><span class="">Mercury</span></summary>
<details open>
<summary title="Mercury.WSRPCPool" class="noexpand"><span class="passing">WSRPCPool</span></summary>
<summary title="Mercury.WSRPCPool"><span class="passing">WSRPCPool</span></summary>
<details open>
<summary title="Mercury.WSRPCPool.CacheSet" class="noexpand"><span class="passing">CacheSet</span></summary>
</details>
</details>
</details>
<details open>
Expand Down
9 changes: 9 additions & 0 deletions core/web/testdata/body/health.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@
"output": ""
}
},
{
"type": "checks",
"id": "Mercury.WSRPCPool.CacheSet",
"attributes": {
"name": "Mercury.WSRPCPool.CacheSet",
"status": "passing",
"output": ""
}
},
{
"type": "checks",
"id": "PipelineORM",
Expand Down
1 change: 1 addition & 0 deletions core/web/testdata/body/health.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
-JobSpawner
-Mailbox.Monitor
-Mercury.WSRPCPool
-Mercury.WSRPCPool.CacheSet
-PipelineORM
-PipelineRunner
-PromReporter
Expand Down

0 comments on commit fbe25a2

Please sign in to comment.