-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
collectors: add inbound fee metric #54
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I think this is a nice metric to help evaluate inbound quality.
@@ -17,3 +17,5 @@ user-config/* | |||
!user-config/.gitkeep | |||
nginx/etc/ssl/* | |||
nginx/etc/.htpasswd | |||
|
|||
cmd/lndmon/lndmon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: newline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the idea was to separate our binaries from other peoples files to ignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no I meant one after cmd/lndmon/lndmon
but non-blocking
collectors/channel_collector_test.go
Outdated
"github.com/stretchr/testify/require" | ||
) | ||
|
||
type inboundFeeTestCase struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this struct? Couldn't we just have testCases=[]struct{...}
then pass 3 params to testGetInboundFee
? I don't think the indenting would be too bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not three, but five in that case. Also the remotePolicies
and remoteBalances
. Sure you want that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did move the test cases into the function.
// total amount. Each iteration, the best channel for that shard is | ||
// selected based on the specific fee. | ||
amountRemaining := amt | ||
for amountRemaining > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an accurate reflection of our available inbound if we don't limit the number of shards? Maybe I'm missing it in here, but it seems like we should be taking that into account, because they can't actually reach us if we exceed shard max.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Max shards is configurable, so we can't make assumptions on that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lnd's default is probably a fair representation of reality, but we can always come back and refine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Nice to start surfacing information like this 📈
Found one nil pointer bug while testing on staging, fixed. |
for _, collectorFunc := range collectors { | ||
err := prometheus.Register(collectorFunc(p.lnd)) | ||
collectors := []prometheus.Collector{ | ||
NewChainCollector(p.lnd), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why's this preferable to the init functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an initialization parameter now that comes from the config. (primary pub key)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be updated now after the merge of the get info collector. The main reason why the existing structure was used was so we'd just need to add the new collector in the file it was created in, rather than here as well. In the end something needs to be updated either way though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased
I wanted to do a bit more testing before merge and also update the json dashboard files. But can do that in a follow-up PR. |
This PR adds a cumulative metric for the routing fee that senders need to pay to the last hop to reach the node that is being monitored. It is an indication of the quality of inbound liquidity.
Example output to Prometheus:
When used in a primary-gateway setup, it is typically required to ignore the internal channels for this metric. This can be indicated by passing the pubkey of the primary node via the
--primarynode
command line flag.