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

feat: metrics collection #900

Merged
merged 9 commits into from
Apr 4, 2023
Merged

feat: metrics collection #900

merged 9 commits into from
Apr 4, 2023

Conversation

Arqu
Copy link
Collaborator

@Arqu Arqu commented Mar 30, 2023

This sets us up for collecting metrics throughout the codebase.
Currently the metrics collection Iroh is added and meant to be for the general collection of metrics. Not married to the name. Didn't have a better idea and wanted to split it out based on subsystems (the incoming derper specifically).

Follow ups on this:

  • make it a compile time feature so it can be completely off (this doesn't send anything outside and even the default endpoint is off by default)
  • sprinkle metrics in the current codebase

@Arqu Arqu self-assigned this Mar 30, 2023
@Arqu Arqu added the metrics extracting quantified mesurements from iroh label Mar 30, 2023
@Arqu Arqu requested a review from dignifiedquire March 30, 2023 12:47
@dignifiedquire
Copy link
Contributor

make it a compile time feature so it can be completely off

Lets do this as part of this PR please, trying to keep the minimum deps to an actual minimum.

@Arqu Arqu requested review from flub and dignifiedquire April 3, 2023 13:39
src/main.rs Outdated
#[cfg(feature = "metrics")]
fn init_metrics_collection(metrics_addr: Option<SocketAddr>) -> tokio::task::JoinHandle<()> {
init_metrics();
tokio::spawn(async move {
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to spawn if we are not going to listen

@Arqu Arqu requested a review from dignifiedquire April 3, 2023 14:08
mod service;

/// Enables metrics collection, otherwise all inc!, record! & observe! calls are no-ops
pub fn init_metrics() {
Copy link
Contributor

Choose a reason for hiding this comment

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

is there an actual use case for doing this and not starting the server?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right away, no. But probably very soon. A quick example would be to have a separate output mechanic we add in like just dump metrics to a file or directly into some local store or push to prometheus. All of which don't require the endpoint itself.

Iroh,
RequestsTotal: Counter: "Total number of requests received",
BytesSent: Counter: "Number of bytes streamed",
BytesReceived: Counter: "Number of bytes received"
Copy link
Contributor

Choose a reason for hiding this comment

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

are these metrics actually recorded?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They are not used, mostly set as an example and I've used them for testing stuff out. I expect to refactor these as soon as we start collecting real metrics.

@Arqu Arqu requested a review from dignifiedquire April 3, 2023 19:44
@dignifiedquire
Copy link
Contributor

confilct time

flub
flub previously approved these changes Apr 4, 2023
@Arqu Arqu merged commit d4a01f7 into main Apr 4, 2023
@Arqu Arqu deleted the arqu/metrics branch April 4, 2023 13:50
matheus23 pushed a commit that referenced this pull request Nov 14, 2024
* feat: metrics collection

* fmt

* make it more cross platform

* make metrics server a cli param

* CR

* CI fixes

* cleanup

* cleanup

* cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
metrics extracting quantified mesurements from iroh
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants