-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
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
node/metrics/src/lib.rs
Outdated
// 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())) |
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.
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.
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.
Makes perfect sense, will update after my work shift
a596ac0
to
069ce38
Compare
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 👍
oops, forgot to clippy and there is an unused import |
069ce38
to
eecf2f1
Compare
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!
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)