Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core/services/relay/evm/mercury/wsrpc: forward health and readiness from CacheSet #11592

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading