@@ -84,24 +84,24 @@ private class BalanceActor(context: ActorContext[Command],
84
84
log.info(" current balance: total={} onchain.confirmed={} onchain.unconfirmed={} offchain={}" , result.total.toDouble, result.onChain.confirmed.toDouble, result.onChain.unconfirmed.toDouble, result.offChain.total.toDouble)
85
85
log.debug(" current balance details : {}" , result)
86
86
Metrics .GlobalBalance .withoutTags().update(result.total.toMilliBtc.toDouble)
87
- Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .OnchainConfirmed ).update(result.onChain.confirmed.toMilliBtc.toLong )
88
- Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .OnchainUnconfirmed ).update(result.onChain.unconfirmed.toMilliBtc.toLong )
89
- Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .Offchain ).withTag(Tags .OffchainState , Tags .OffchainStates .waitForFundingConfirmed).update(result.offChain.waitForFundingConfirmed.toMilliBtc.toLong )
90
- Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .Offchain ).withTag(Tags .OffchainState , Tags .OffchainStates .waitForFundingLocked).update(result.offChain.waitForFundingLocked.toMilliBtc.toLong )
91
- Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .Offchain ).withTag(Tags .OffchainState , Tags .OffchainStates .normal).update(result.offChain.normal.total.toMilliBtc.toLong )
92
- Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .Offchain ).withTag(Tags .OffchainState , Tags .OffchainStates .shutdown).update(result.offChain.shutdown.total.toMilliBtc.toLong )
93
- Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .Offchain ).withTag(Tags .OffchainState , Tags .OffchainStates .closingLocal).update(result.offChain.closing.localCloseBalance.total.toMilliBtc.toLong )
94
- Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .Offchain ).withTag(Tags .OffchainState , Tags .OffchainStates .closingRemote).update(result.offChain.closing.remoteCloseBalance.total.toMilliBtc.toLong )
95
- Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .Offchain ).withTag(Tags .OffchainState , Tags .OffchainStates .closingUnknown).update(result.offChain.closing.unknownCloseBalance.total.toMilliBtc.toLong )
96
- Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .Offchain ).withTag(Tags .OffchainState , Tags .OffchainStates .waitForPublishFutureCommitment).update(result.offChain.waitForPublishFutureCommitment.toMilliBtc.toLong )
87
+ Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .OnchainConfirmed ).update(result.onChain.confirmed.toMilliBtc.toDouble )
88
+ Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .OnchainUnconfirmed ).update(result.onChain.unconfirmed.toMilliBtc.toDouble )
89
+ Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .Offchain ).withTag(Tags .OffchainState , Tags .OffchainStates .waitForFundingConfirmed).update(result.offChain.waitForFundingConfirmed.toMilliBtc.toDouble )
90
+ Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .Offchain ).withTag(Tags .OffchainState , Tags .OffchainStates .waitForFundingLocked).update(result.offChain.waitForFundingLocked.toMilliBtc.toDouble )
91
+ Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .Offchain ).withTag(Tags .OffchainState , Tags .OffchainStates .normal).update(result.offChain.normal.total.toMilliBtc.toDouble )
92
+ Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .Offchain ).withTag(Tags .OffchainState , Tags .OffchainStates .shutdown).update(result.offChain.shutdown.total.toMilliBtc.toDouble )
93
+ Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .Offchain ).withTag(Tags .OffchainState , Tags .OffchainStates .closingLocal).update(result.offChain.closing.localCloseBalance.total.toMilliBtc.toDouble )
94
+ Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .Offchain ).withTag(Tags .OffchainState , Tags .OffchainStates .closingRemote).update(result.offChain.closing.remoteCloseBalance.total.toMilliBtc.toDouble )
95
+ Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .Offchain ).withTag(Tags .OffchainState , Tags .OffchainStates .closingUnknown).update(result.offChain.closing.unknownCloseBalance.total.toMilliBtc.toDouble )
96
+ Metrics .GlobalBalanceDetailed .withTag(Tags .BalanceType , Tags .BalanceTypes .Offchain ).withTag(Tags .OffchainState , Tags .OffchainStates .waitForPublishFutureCommitment).update(result.offChain.waitForPublishFutureCommitment.toMilliBtc.toDouble )
97
97
refBalance_opt match {
98
98
case Some (refBalance) =>
99
99
val normalizedValue = 100 + (if (refBalance.total.toSatoshi.toLong > 0 ) (result.total.toSatoshi.toLong - refBalance.total.toSatoshi.toLong) * 1000D / refBalance.total.toSatoshi.toLong else 0 )
100
100
val diffValue = result.total.toSatoshi.toLong - refBalance.total.toSatoshi.toLong
101
101
log.info(" relative balance: current={} reference={} normalized={} diff={}" , result.total.toDouble, refBalance.total.toDouble, normalizedValue, diffValue)
102
102
Metrics .GlobalBalanceNormalized .withoutTags().update(normalizedValue)
103
- Metrics .GlobalBalanceDiff .withTag(Tags .DiffSign , Tags .DiffSigns .plus).update(diffValue.max(0 ))
104
- Metrics .GlobalBalanceDiff .withTag(Tags .DiffSign , Tags .DiffSigns .minus).update((- diffValue).max(0 ))
103
+ Metrics .GlobalBalanceDiff .withTag(Tags .DiffSign , Tags .DiffSigns .plus).update(diffValue.max(0 ).toDouble )
104
+ Metrics .GlobalBalanceDiff .withTag(Tags .DiffSign , Tags .DiffSigns .minus).update((- diffValue).max(0 ).toDouble )
105
105
Behaviors .same
106
106
case None =>
107
107
log.info(" using balance={} as reference" , result.total.toDouble)
0 commit comments