Skip to content
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

lnd_peer_count of type counter instead of gauge #85

Open
bindermuehle opened this issue Sep 7, 2022 · 4 comments
Open

lnd_peer_count of type counter instead of gauge #85

bindermuehle opened this issue Sep 7, 2022 · 4 comments
Labels
enhancement New feature or request p2p

Comments

@bindermuehle
Copy link

I'm trying to setup a dashboard for our lnd node with lndmon and I am running into an issue that the lnd_peer_count metric type is a counter instead of a gauge.

To me it seems this value can go and and down and thus a gauge is better suited.

Thanks for clarifying!

p.peerCountDesc, prometheus.CounterValue,

	ch <- prometheus.MustNewConstMetric(
		p.peerCountDesc, prometheus.CounterValue,
		float64(len(listPeersResp)),
	)

@Roasbeef Roasbeef added enhancement New feature or request p2p labels Sep 7, 2022
@Roasbeef
Copy link
Member

Roasbeef commented Sep 7, 2022

IIUC, we added this as a count so we could compute things like the rate of peer flapping (connects/disconnects per second).

@bindermuehle
Copy link
Author

bindermuehle commented Sep 7, 2022

I found the computation of flap rate calculation here:

"expr": "deriv(lnd_peer_count{namespace=\"$namespace\",pod=\"$node\"}[40s])",

it is using the deriv function which according to prometheus documentation should only be used with gauges:
https://prometheus.io/docs/prometheus/latest/querying/functions/#deriv

@Roasbeef
Copy link
Member

Roasbeef commented Sep 7, 2022

it is using the deriv function which according to prometheus documentation should only be used with gauges:

Ahh, TIL!

We'd def accept a PR to either export a new gauge along side, then we can later deprecate the existing one.

@bindermuehle
Copy link
Author

ok, I'm not that deep into the project but if I find time I'll take a look. Do you have a naming scheme for this scenario?
I would suggest something like
lnd_peer_count_new or lnd_peer_count_gauge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request p2p
Projects
None yet
Development

No branches or pull requests

2 participants