From a70336b7f57a421021d5aa2b1c6ba95296c0628a Mon Sep 17 00:00:00 2001 From: kirill Date: Fri, 18 Sep 2026 13:43:14 +0400 Subject: [PATCH] Fix algorand metrics --- .../io/emeraldpay/dshackle/upstream/avm/AvmChainSpecific.kt | 5 +++-- .../emeraldpay/dshackle/upstream/avm/AvmChainSpecificTest.kt | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/avm/AvmChainSpecific.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/avm/AvmChainSpecific.kt index fa49bf701..0a965a362 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/avm/AvmChainSpecific.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/avm/AvmChainSpecific.kt @@ -35,11 +35,12 @@ object AvmChainSpecific : AbstractPollChainSpecific() { val status = Global.objectMapper.readValue(data, AvmStatus::class.java) val round = status.lastRound val blockRequest = ChainRequest( - "GET#/v2/blocks/$round", + // template method with the round as a path param, so the metrics `method` label stays bounded + "GET#/v2/blocks/*", RestParams( headers = emptyList(), queryParams = listOf("format" to "json", "header-only" to "true"), - pathParams = emptyList(), + pathParams = listOf(round.toString()), payload = ByteArray(0), ), ) diff --git a/src/test/kotlin/io/emeraldpay/dshackle/upstream/avm/AvmChainSpecificTest.kt b/src/test/kotlin/io/emeraldpay/dshackle/upstream/avm/AvmChainSpecificTest.kt index 2aaa86f57..6e4d948e3 100644 --- a/src/test/kotlin/io/emeraldpay/dshackle/upstream/avm/AvmChainSpecificTest.kt +++ b/src/test/kotlin/io/emeraldpay/dshackle/upstream/avm/AvmChainSpecificTest.kt @@ -4,6 +4,7 @@ import io.emeraldpay.dshackle.reader.ChainReader import io.emeraldpay.dshackle.upstream.ChainRequest import io.emeraldpay.dshackle.upstream.ChainResponse import io.emeraldpay.dshackle.upstream.UpstreamAvailability +import io.emeraldpay.dshackle.upstream.rpcclient.RestParams import org.assertj.core.api.Assertions import org.junit.jupiter.api.Test import reactor.core.publisher.Mono @@ -55,7 +56,8 @@ class AvmChainSpecificTest { fun parseBlockChainsThroughBlockEndpoint() { val reader = object : ChainReader { override fun read(key: ChainRequest): Mono { - Assertions.assertThat(key.method).isEqualTo("GET#/v2/blocks/30000000") + Assertions.assertThat(key.method).isEqualTo("GET#/v2/blocks/*") + Assertions.assertThat((key.params as RestParams).pathParams).containsExactly("30000000") return Mono.just(ChainResponse(avmBlockHeader.toByteArray(), null)) } }