File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed
main/java/com/iexec/blockchain/version
test/java/com/iexec/blockchain/version Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ All notable changes to this project will be documented in this file.
99- Send up to 2 blockchain transactions per block.
1010 With a big enough latency, the nonce is properly computed in web3j library against the pending block. (#111 )
1111- Add ` BlockchainAdapterService ` class to implement interactions with REST API. (#117 #118 #119 )
12- - Expose version through prometheus endpoint and through VersionController. (#122 )
12+ - Expose version through prometheus endpoint and through VersionController. (#122 # 123 )
1313
1414### Bug Fixes
1515
Original file line number Diff line number Diff line change @@ -32,7 +32,8 @@ public class VersionController {
3232 public static final String METRIC_INFO_GAUGE_DESC = "A metric to expose version and application name." ;
3333 public static final String METRIC_INFO_LABEL_APP_NAME = "iexecAppName" ;
3434 public static final String METRIC_INFO_LABEL_APP_VERSION = "iexecAppVersion" ;
35-
35+ // Must be static final to avoid garbage collect and side effect on gauge
36+ public static final int METRIC_VALUE = 1 ;
3637 private final BuildProperties buildProperties ;
3738
3839 public VersionController (BuildProperties buildProperties ) {
@@ -41,7 +42,7 @@ public VersionController(BuildProperties buildProperties) {
4142
4243 @ PostConstruct
4344 void initializeGaugeVersion () {
44- Gauge .builder (METRIC_INFO_GAUGE_NAME , 1.0 , n -> n )
45+ Gauge .builder (METRIC_INFO_GAUGE_NAME , METRIC_VALUE , n -> METRIC_VALUE )
4546 .description (METRIC_INFO_GAUGE_DESC )
4647 .tags (METRIC_INFO_LABEL_APP_VERSION , buildProperties .getVersion (),
4748 METRIC_INFO_LABEL_APP_NAME , buildProperties .getName ())
Original file line number Diff line number Diff line change @@ -75,5 +75,6 @@ void shouldReturnInfoGauge() {
7575 id -> id .getTag (VersionController .METRIC_INFO_LABEL_APP_VERSION )
7676 )
7777 .containsExactly (buildProperties .getName (), buildProperties .getVersion ());
78+ assertThat (info .value ()).isEqualTo (VersionController .METRIC_VALUE );
7879 }
7980}
You can’t perform that action at this time.
0 commit comments