-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from projectNEWM/amw/health_metrics_api
Add health metrics API
- Loading branch information
Showing
10 changed files
with
199 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/kotlin/io/newm/kogmios/protocols/model/CardanoEra.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.newm.kogmios.protocols.model | ||
|
||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.json.JsonNames | ||
|
||
@Serializable | ||
enum class CardanoEra { | ||
@JsonNames("byron") | ||
BYRON, | ||
|
||
@JsonNames("shelley") | ||
SHELLEY, | ||
|
||
@JsonNames("allegra") | ||
ALLEGRA, | ||
|
||
@JsonNames("mary") | ||
MARY, | ||
|
||
@JsonNames("alonzo") | ||
ALONZO, | ||
|
||
@JsonNames("babbage") | ||
BABBAGE, | ||
|
||
@JsonNames("conway") | ||
CONWAY, | ||
} |
65 changes: 65 additions & 0 deletions
65
src/main/kotlin/io/newm/kogmios/protocols/model/result/HealthResult.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package io.newm.kogmios.protocols.model.result | ||
|
||
import io.newm.kogmios.protocols.model.CardanoEra | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class HealthResult( | ||
@SerialName("connectionStatus") | ||
val connectionStatus: String, | ||
@SerialName("currentEpoch") | ||
val currentEpoch: Long, | ||
@SerialName("currentEra") | ||
val currentEra: CardanoEra, | ||
@SerialName("lastKnownTip") | ||
val lastKnownTip: LastKnownTip, | ||
@SerialName("lastTipUpdate") | ||
val lastTipUpdate: String, | ||
@SerialName("metrics") | ||
val metrics: Metrics, | ||
@SerialName("network") | ||
val network: String, | ||
@SerialName("networkSynchronization") | ||
val networkSynchronization: Double, | ||
@SerialName("slotInEpoch") | ||
val slotInEpoch: Long, | ||
@SerialName("startTime") | ||
val startTime: String, | ||
@SerialName("version") | ||
val version: String | ||
) | ||
|
||
// { | ||
// "metrics": { | ||
// "totalUnrouted": 1, | ||
// "totalMessages": 30029, | ||
// "runtimeStats": { | ||
// "gcCpuTime": 1233009354, | ||
// "cpuTime": 81064672549, | ||
// "maxHeapSize": 41630, | ||
// "currentHeapSize": 1014 | ||
// }, | ||
// "totalConnections": 10, | ||
// "sessionDurations": { | ||
// "max": 57385, | ||
// "mean": 7057, | ||
// "min": 0 | ||
// }, | ||
// "activeConnections": 0 | ||
// }, | ||
// "startTime": "2021-03-15T16:16:41.470782977Z", | ||
// "lastTipUpdate": "2021-03-15T16:28:36.853115034Z", | ||
// "lastKnownTip": { | ||
// "hash": "c29428f386c701c1d1ba1fd259d4be78921ee9ee6c174eac898245ceb55e8061", | ||
// "blockNo": 5034297, | ||
// "slot": 15520688 | ||
// }, | ||
// "networkSynchronization": 0.99, | ||
// "currentEra": "mary", | ||
// "connectionStatus": "disconnected", | ||
// "currentEpoch": 164, | ||
// "slotInEpoch": 324543, | ||
// "version": "6.0.0", | ||
// "network": "mainnet" | ||
// } |
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/io/newm/kogmios/protocols/model/result/LastKnownTip.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.newm.kogmios.protocols.model.result | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class LastKnownTip( | ||
@SerialName("height") | ||
val height: Long, | ||
@SerialName("id") | ||
val id: String, | ||
@SerialName("slot") | ||
val slot: Long, | ||
) |
20 changes: 20 additions & 0 deletions
20
src/main/kotlin/io/newm/kogmios/protocols/model/result/Metrics.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.newm.kogmios.protocols.model.result | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class Metrics( | ||
@SerialName("activeConnections") | ||
val activeConnections: Int, | ||
@SerialName("runtimeStats") | ||
val runtimeStats: RuntimeStats, | ||
@SerialName("sessionDurations") | ||
val sessionDurations: SessionDurations, | ||
@SerialName("totalConnections") | ||
val totalConnections: Long, | ||
@SerialName("totalMessages") | ||
val totalMessages: Long, | ||
@SerialName("totalUnrouted") | ||
val totalUnrouted: Long, | ||
) |
16 changes: 16 additions & 0 deletions
16
src/main/kotlin/io/newm/kogmios/protocols/model/result/RuntimeStats.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.newm.kogmios.protocols.model.result | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class RuntimeStats( | ||
@SerialName("cpuTime") | ||
val cpuTime: Long, | ||
@SerialName("currentHeapSize") | ||
val currentHeapSize: Long, | ||
@SerialName("gcCpuTime") | ||
val gcCpuTime: Long, | ||
@SerialName("maxHeapSize") | ||
val maxHeapSize: Long, | ||
) |
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/io/newm/kogmios/protocols/model/result/SessionDurations.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.newm.kogmios.protocols.model.result | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class SessionDurations( | ||
@SerialName("max") | ||
val max: Double, | ||
@SerialName("mean") | ||
val mean: Double, | ||
@SerialName("min") | ||
val min: Double, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters