mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-03 17:26:57 +01:00
routing: track real-time payment and attempt counts
These metrics can serve as the basis for computing average payment throughput or average number of attempts per payment.
This commit is contained in:
parent
951849709b
commit
4559fafad6
2 changed files with 8 additions and 0 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/monitoring"
|
||||
"github.com/lightningnetwork/lnd/multimutex"
|
||||
"github.com/lightningnetwork/lnd/queue"
|
||||
)
|
||||
|
@ -191,6 +192,9 @@ func (p *controlTower) InitPayment(paymentHash lntypes.Hash,
|
|||
return err
|
||||
}
|
||||
|
||||
// Observe the creation of a new payment.
|
||||
monitoring.IncrementPaymentCount()
|
||||
|
||||
// Take lock before querying the db to prevent missing or duplicating
|
||||
// an update.
|
||||
p.paymentsMtx.Lock(paymentHash)
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/monitoring"
|
||||
"github.com/lightningnetwork/lnd/routing/route"
|
||||
"github.com/lightningnetwork/lnd/routing/shards"
|
||||
"github.com/lightningnetwork/lnd/tlv"
|
||||
|
@ -596,6 +597,9 @@ func (p *paymentLifecycle) registerAttempt(rt *route.Route,
|
|||
p.identifier, &attempt.HTLCAttemptInfo,
|
||||
)
|
||||
|
||||
// Observe a new HTLC attempt for the payment.
|
||||
monitoring.IncrementHTLCAttemptCount()
|
||||
|
||||
return attempt, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue