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

identify: add metrics #2126

Merged
merged 3 commits into from
Feb 23, 2023
Merged

Conversation

sukunrt
Copy link
Member

@sukunrt sukunrt commented Feb 22, 2023

added metrics for:
address count
protocol count
peer push support

metrics added:
address count
protocol count
peer push support
Comment on lines 333 to 334
"title": "Outgoing Address Count",
"type": "gauge"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks a bit misleading since the gauge is never full. Any suggestions here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using a Stat? That way you'd also if a change brought number up or down:
image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed this.

Comment on lines 409 to 411
"title": "Outgoing Protocols Count",
"type": "gauge"
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here the gauge may be a bit empty and so a bit misleading.

Comment on lines 586 to 592
}
mes.ListenAddrs = append(mes.ListenAddrs, addr.Bytes())
}
if ids.metricsTracer != nil {
ids.metricsTracer.NumProtocols(len(mes.Protocols))
ids.metricsTracer.NumAddrs(len(mes.ListenAddrs))
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can simplify this a bit if we are fine with counting snaphot.Addrs as Num Address Sent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should rework the API a bit. Might be nice to have a Identify{Push}Received(numProtos, numAddrs int). wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed. will fix this.

@sukunrt
Copy link
Member Author

sukunrt commented Feb 22, 2023

@marten-seemann left comments at a few places where I'm confused. Suggestions would be very helpful.

@sukunrt sukunrt marked this pull request as ready for review February 22, 2023 11:53
@MarcoPolo MarcoPolo self-requested a review February 22, 2023 18:06
@marten-seemann marten-seemann linked an issue Feb 22, 2023 that may be closed by this pull request
p2p/protocol/identify/id.go Outdated Show resolved Hide resolved
p2p/protocol/identify/id.go Outdated Show resolved Hide resolved
Comment on lines 586 to 592
}
mes.ListenAddrs = append(mes.ListenAddrs, addr.Bytes())
}
if ids.metricsTracer != nil {
ids.metricsTracer.NumProtocols(len(mes.Protocols))
ids.metricsTracer.NumAddrs(len(mes.ListenAddrs))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should rework the API a bit. Might be nice to have a Identify{Push}Received(numProtos, numAddrs int). wdyt?

@sukunrt
Copy link
Member Author

sukunrt commented Feb 23, 2023

addressed review comments. This looks much cleaner now.

I think we can remove counting peers by push support. On my node there are no peers with push not supported. So it doesn't look too useful. Do you think this metric would be useful?

Copy link
Contributor

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@marten-seemann marten-seemann merged commit f7bf9d8 into libp2p:master Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

identify: expose metrics
2 participants