Skip to content

Commit 9684455

Browse files
nitramizcdecker
authored andcommitted
Prometheus: Fix msat to sat conversion
1 parent 8c45799 commit 9684455

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

archived/prometheus/prometheus.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ def collect(self):
4848
funds = self.rpc.listfunds()
4949
print(funds['outputs'])
5050
output_funds = sum(
51-
[o['amount_msat'].to_satoshi() for o in funds['outputs']]
51+
[o['amount_msat'] // 1000 for o in funds['outputs']]
5252
)
5353
channel_funds = sum(
54-
[c['our_amount_msat'].to_satoshi() for c in funds['channels']]
54+
[c['our_amount_msat'] // 1000 for c in funds['channels']]
5555
)
5656
total = output_funds + channel_funds
5757

@@ -181,10 +181,10 @@ def collect(self):
181181
alias = 'unknown'
182182

183183
labels = [c['peer_id'], c.get('short_channel_id', c.get('channel_id')), alias]
184-
balance_gauge.add_metric(labels, c['to_us_msat'].to_satoshi())
184+
balance_gauge.add_metric(labels, c['to_us_msat'] // 1000)
185185
spendable_gauge.add_metric(labels,
186-
c['spendable_msat'].to_satoshi())
187-
total_gauge.add_metric(labels, c['total_msat'].to_satoshi())
186+
c['spendable_msat'] // 1000)
187+
total_gauge.add_metric(labels, c['total_msat'] // 1000)
188188
htlc_gauge.add_metric(labels, len(c['htlcs']))
189189

190190
in_payments_offered_gauge.add_metric(labels, c['in_payments_offered'])

0 commit comments

Comments
 (0)