-
Notifications
You must be signed in to change notification settings - Fork 159
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
metrics-exporter-prometheus crashes if port 9000 blocked #501
Comments
👋 I saw and responded on the linked issue, but just to dive in a little here:
This is expected since we can't bind to a port already in use.
Now this part makes me pause. Do you have a reproduction for the "even if you tell it to use a different port" part? I'm not actually seeing how that would be possible. |
I definitely can't reproduce that last part. Changed the default http listener in let (recorder, _) = PrometheusBuilder::new()
.upkeep_timeout(Duration::from_secs(5))
.with_http_listener(([0, 0, 0, 0], 9001))
.unwrap()
.build()
.expect("Failed to build metrics recorder"); then ran |
Ran into this again because I hadn't properly fixed it last time. I think I have it this time. But it does mean I cannot use a really nice axum_prometheus helper function. Would it be possible to add a |
Without doing some sort of typestate builder to determine what gets returned/installed by the It feels like what we could get away with is something like... pub struct PrometheusBuilder {
// Two builder methods that don't install anything:
pub fn build(self) -> Result<(PrometheusRecorder, UpkeepFut, ExporterFut), BuildError>;
pub fn build_recorder(self) -> Result<(PrometheusRecorder, UpkeepFut), BuildError>;
// This method builds everything, installs the recorder, and spawns the upkeep future
// and exporter future:
pub fn install(self) -> Result<(), BuildError>;
// This method builds everything, installs the recorder, and spawns the upkeep future
// but returns a handle to the recorder for the caller to manually handle generating
// the payloads:
pub fn install_recorder(self) -> Result<PrometheusHandle, BuildError>;
} I think @Ptrskay3 How does that sound? I'm a little fuzzy these days on how |
That sounds reasonable to me. Currently we use the The the push-gateway mode is not really thought out in |
If you have something already using port 9000, metrics-exporter-prometheus crashes at
metrics/metrics-exporter-prometheus/src/exporter/builder.rs
Line 61 in ca453d3
More info: Ptrskay3/axum-prometheus#66
The text was updated successfully, but these errors were encountered: