Skip to content

Commit

Permalink
Merge pull request #850 from iotaledger/feat/add-network-health
Browse files Browse the repository at this point in the history
Breaking: Add network health endpoint and flag
  • Loading branch information
muXxer authored Mar 21, 2024
2 parents befbb3a + ccc4fba commit 7929a5a
Show file tree
Hide file tree
Showing 13 changed files with 232 additions and 130 deletions.
8 changes: 8 additions & 0 deletions components/restapi/core/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ func configure() error {
return responseByHeader(c, resp)
})

routeGroup.GET(api.CoreEndpointNetworkHealth, func(c echo.Context) error {
if deps.RequestHandler.IsNetworkHealthy() {
return c.NoContent(http.StatusOK)
}

return c.NoContent(http.StatusServiceUnavailable)
})

routeGroup.GET(api.CoreEndpointNetworkMetrics, func(c echo.Context) error {
resp := metrics()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5289,7 +5289,7 @@
"step": 240
}
],
"title": "Memory Commited",
"title": "Memory Committed",
"type": "timeseries"
},
{
Expand Down Expand Up @@ -10381,7 +10381,7 @@
"expr": "node_memory_NFS_Unstable_bytes{instance=\"$node\",job=\"$job\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "NFS Unstable - Memory in NFS pages sent to the server, but not yet commited to the storage",
"legendFormat": "NFS Unstable - Memory in NFS pages sent to the server, but not yet committed to the storage",
"refId": "A",
"step": 240
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ require (
github.com/iotaledger/hive.go/stringify v0.0.0-20240315104458-b689cbcfddbd
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240307101848-db58eb9353ec
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240307100839-48553e1d2022
github.com/iotaledger/iota.go/v4 v4.0.0-20240313065735-74f8cf10c361
github.com/iotaledger/iota.go/v4 v4.0.0-20240319114032-b6fcc3585c99
github.com/labstack/echo/v4 v4.11.4
github.com/labstack/gommon v0.4.2
github.com/libp2p/go-libp2p v0.33.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240307100839-48553e1d2022 h1:I178Sa
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240307100839-48553e1d2022/go.mod h1:jTFxIWiMUdAwO263jlJCSWcNLqEkgYEVOFXfjp5aNJM=
github.com/iotaledger/iota-crypto-demo v0.0.0-20240216103559-27ca8dffd1e7 h1:t6k4MqiUov0FrBb2o2JhKlOVSdlPbIQWM8ivYHL0G0g=
github.com/iotaledger/iota-crypto-demo v0.0.0-20240216103559-27ca8dffd1e7/go.mod h1:do+N3LpeDEi9qselEC4XcjqGoRc7cWGiqBtIeBOKEMs=
github.com/iotaledger/iota.go/v4 v4.0.0-20240313065735-74f8cf10c361 h1:fKvfJZ4byivRRKkqF6JPj8I4pDSN0y+bgF4I4HI11Lo=
github.com/iotaledger/iota.go/v4 v4.0.0-20240313065735-74f8cf10c361/go.mod h1:8UQOTI7CC5R/3TurawUFuBZbkb37RzW8m4q8Hp7ct30=
github.com/iotaledger/iota.go/v4 v4.0.0-20240319114032-b6fcc3585c99 h1:Fs4LqQ8VavnOkv4fRkEex8hVvnnqt1uVSY6R9hocPSU=
github.com/iotaledger/iota.go/v4 v4.0.0-20240319114032-b6fcc3585c99/go.mod h1:8UQOTI7CC5R/3TurawUFuBZbkb37RzW8m4q8Hp7ct30=
github.com/ipfs/boxo v0.18.0 h1:MOL9/AgoV3e7jlVMInicaSdbgralfqSsbkc31dZ9tmw=
github.com/ipfs/boxo v0.18.0/go.mod h1:pIZgTWdm3k3pLF9Uq6MB8JEcW07UDwNJjlXW1HELW80=
github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s=
Expand Down
5 changes: 5 additions & 0 deletions pkg/protocol/engine/syncmanager/syncmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ type SyncManager interface {
// IsNodeSynced returns bool indicating if a node is synced.
IsNodeSynced() bool

// IsFinalizationDelayed returns bool indicating if the finalization is delayed
// (latest committed slot - latest finalized slot > max committable age).
IsFinalizationDelayed() bool

// LastAcceptedBlockSlot returns the slot of the latest accepted block.
LastAcceptedBlockSlot() iotago.SlotIndex

Expand All @@ -40,6 +44,7 @@ type SyncManager interface {
type SyncStatus struct {
NodeBootstrapped bool
NodeSynced bool
FinalizationDelayed bool
LastAcceptedBlockSlot iotago.SlotIndex
LastConfirmedBlockSlot iotago.SlotIndex
LatestCommitment *model.Commitment
Expand Down
Loading

0 comments on commit 7929a5a

Please sign in to comment.