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

add configurable metrics listening cli option #3360

Open
wants to merge 1 commit into
base: mainnet-staging
Choose a base branch
from

Conversation

HarukaMa
Copy link
Contributor

@HarukaMa HarukaMa commented Jul 10, 2024

Motivation

Add an snarkOS cli option to configure the listening host and port of the metrics exporter.

Although I think listening to 127.0.0.1 by default should be a better default value, I kept 0.0.0.0 to not break existing users (the previous default was hardcoded 0.0.0.0:9000). Same for the cli option name, although it's different from rest and cdn options. Lemme know if breaking backwards compatibility is acceptable there.

Test Plan

Tested locally

Related PRs

(Link any related PRs here)

@zosorock zosorock requested review from ljedrz, a team and miazn July 10, 2024 21:09
Meshiest
Meshiest previously approved these changes Jul 10, 2024
Copy link
Contributor

@Meshiest Meshiest left a comment

Choose a reason for hiding this comment

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

LGTM

// Build the Prometheus exporter.
metrics_exporter_prometheus::PrometheusBuilder::new().install().expect("can't build the prometheus exporter");
metrics_exporter_prometheus::PrometheusBuilder::new()
.with_http_listener(ip.unwrap_or(SocketAddr::from_str("0.0.0.0:9000").unwrap()))
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer not to hard-code the default socketAddr like this - SocketAddr::from_str("0.0.0.0:9000).

Even if it's functionally the same as calling metrics_exporter_prometheus::PrometheusBuilder::new() now, if the defaults in PrometheusBuilder change in the future, we would need to manually perform the update.

Ideally, we keep the old syntax if ip is not specified here. Maybe with a match case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes perfect sense, will update after my work shift

cli/src/commands/start.rs Outdated Show resolved Hide resolved
cli/src/commands/start.rs Outdated Show resolved Hide resolved
ljedrz
ljedrz previously approved these changes Jul 11, 2024
Copy link
Collaborator

@ljedrz ljedrz left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@HarukaMa
Copy link
Contributor Author

oops, forgot to clippy and there is an unused import

Copy link
Contributor

@raychu86 raychu86 left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

4 participants