Open bryanlarsen opened 1 month ago
:wave:
I saw and responded on the linked issue, but just to dive in a little here:
If you have something already using port 9000, metrics-exporter-prometheus crashes..
This is expected since we can't bind to a port already in use.
, even if you never call install(), and even if you use with_http_listener to tell it to use a different port.
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 axum-prometheus
to:
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 netcat -l 9000
, and my examples build and work just fine. Without this change they did panic because of the 9000 port already is use.
If you have something already using port 9000, metrics-exporter-prometheus crashes at https://github.com/metrics-rs/metrics/blob/ca453d31009e1809161a0644943bbf5a8b3eb2e6/metrics-exporter-prometheus/src/exporter/builder.rs#L61, even if you never call install(), and even if you use with_http_listener to tell it to use a different port.
More info: https://github.com/Ptrskay3/axum-prometheus/issues/66