Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit 7929a5a

Browse files
authored
Merge pull request #850 from iotaledger/feat/add-network-health
Breaking: Add network health endpoint and flag
2 parents befbb3a + ccc4fba commit 7929a5a

File tree

13 files changed

+232
-130
lines changed

13 files changed

+232
-130
lines changed

components/restapi/core/component.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ func configure() error {
4848
return responseByHeader(c, resp)
4949
})
5050

51+
routeGroup.GET(api.CoreEndpointNetworkHealth, func(c echo.Context) error {
52+
if deps.RequestHandler.IsNetworkHealthy() {
53+
return c.NoContent(http.StatusOK)
54+
}
55+
56+
return c.NoContent(http.StatusServiceUnavailable)
57+
})
58+
5159
routeGroup.GET(api.CoreEndpointNetworkMetrics, func(c echo.Context) error {
5260
resp := metrics()
5361

deploy/ansible/roles/metrics/files/grafana/provisioning/dashboards/node-exporter.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5289,7 +5289,7 @@
52895289
"step": 240
52905290
}
52915291
],
5292-
"title": "Memory Commited",
5292+
"title": "Memory Committed",
52935293
"type": "timeseries"
52945294
},
52955295
{
@@ -10381,7 +10381,7 @@
1038110381
"expr": "node_memory_NFS_Unstable_bytes{instance=\"$node\",job=\"$job\"}",
1038210382
"format": "time_series",
1038310383
"intervalFactor": 1,
10384-
"legendFormat": "NFS Unstable - Memory in NFS pages sent to the server, but not yet commited to the storage",
10384+
"legendFormat": "NFS Unstable - Memory in NFS pages sent to the server, but not yet committed to the storage",
1038510385
"refId": "A",
1038610386
"step": 240
1038710387
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ require (
2929
github.com/iotaledger/hive.go/stringify v0.0.0-20240315104458-b689cbcfddbd
3030
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240307101848-db58eb9353ec
3131
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240307100839-48553e1d2022
32-
github.com/iotaledger/iota.go/v4 v4.0.0-20240313065735-74f8cf10c361
32+
github.com/iotaledger/iota.go/v4 v4.0.0-20240319114032-b6fcc3585c99
3333
github.com/labstack/echo/v4 v4.11.4
3434
github.com/labstack/gommon v0.4.2
3535
github.com/libp2p/go-libp2p v0.33.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240307100839-48553e1d2022 h1:I178Sa
325325
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240307100839-48553e1d2022/go.mod h1:jTFxIWiMUdAwO263jlJCSWcNLqEkgYEVOFXfjp5aNJM=
326326
github.com/iotaledger/iota-crypto-demo v0.0.0-20240216103559-27ca8dffd1e7 h1:t6k4MqiUov0FrBb2o2JhKlOVSdlPbIQWM8ivYHL0G0g=
327327
github.com/iotaledger/iota-crypto-demo v0.0.0-20240216103559-27ca8dffd1e7/go.mod h1:do+N3LpeDEi9qselEC4XcjqGoRc7cWGiqBtIeBOKEMs=
328-
github.com/iotaledger/iota.go/v4 v4.0.0-20240313065735-74f8cf10c361 h1:fKvfJZ4byivRRKkqF6JPj8I4pDSN0y+bgF4I4HI11Lo=
329-
github.com/iotaledger/iota.go/v4 v4.0.0-20240313065735-74f8cf10c361/go.mod h1:8UQOTI7CC5R/3TurawUFuBZbkb37RzW8m4q8Hp7ct30=
328+
github.com/iotaledger/iota.go/v4 v4.0.0-20240319114032-b6fcc3585c99 h1:Fs4LqQ8VavnOkv4fRkEex8hVvnnqt1uVSY6R9hocPSU=
329+
github.com/iotaledger/iota.go/v4 v4.0.0-20240319114032-b6fcc3585c99/go.mod h1:8UQOTI7CC5R/3TurawUFuBZbkb37RzW8m4q8Hp7ct30=
330330
github.com/ipfs/boxo v0.18.0 h1:MOL9/AgoV3e7jlVMInicaSdbgralfqSsbkc31dZ9tmw=
331331
github.com/ipfs/boxo v0.18.0/go.mod h1:pIZgTWdm3k3pLF9Uq6MB8JEcW07UDwNJjlXW1HELW80=
332332
github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s=

pkg/protocol/engine/syncmanager/syncmanager.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ type SyncManager interface {
1616
// IsNodeSynced returns bool indicating if a node is synced.
1717
IsNodeSynced() bool
1818

19+
// IsFinalizationDelayed returns bool indicating if the finalization is delayed
20+
// (latest committed slot - latest finalized slot > max committable age).
21+
IsFinalizationDelayed() bool
22+
1923
// LastAcceptedBlockSlot returns the slot of the latest accepted block.
2024
LastAcceptedBlockSlot() iotago.SlotIndex
2125

@@ -40,6 +44,7 @@ type SyncManager interface {
4044
type SyncStatus struct {
4145
NodeBootstrapped bool
4246
NodeSynced bool
47+
FinalizationDelayed bool
4348
LastAcceptedBlockSlot iotago.SlotIndex
4449
LastConfirmedBlockSlot iotago.SlotIndex
4550
LatestCommitment *model.Commitment

0 commit comments

Comments
 (0)