From 8076c81dd6e8213b107718764ec9e094b7653f04 Mon Sep 17 00:00:00 2001 From: kan Date: Tue, 30 Apr 2024 13:33:20 +0400 Subject: [PATCH] solution: add upstream height metric --- .../kotlin/io/emeraldpay/dshackle/upstream/Multistream.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/Multistream.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/Multistream.kt index a324ae18e..31d916708 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/Multistream.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/Multistream.kt @@ -90,6 +90,12 @@ abstract class Multistream( ) { it.getLag().toDouble() } + Metrics.gauge( + "$metrics.height", + listOf(Tag.of("chain", chain.chainCode), Tag.of("upstream", upstream.getId())), upstream + ) { + it.getHead().getCurrentHeight()?.toDouble() ?: 0.0 + } } open fun init() {