Skip to content

Commit 0658122

Browse files
authored
fix: metrics endpoint listens on ipv6 as well (#332)
1 parent 8195281 commit 0658122

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

etl-telemetry/src/metrics.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,14 @@ pub fn init_metrics_handle() -> Result<PrometheusHandle, BuildError> {
5454
}
5555

5656
/// This method initialized metrics by installing a global metrics recorder.
57-
/// It also starts listening on an http endpoint at `0.0.0.0:9000/metrics`
58-
/// for scrapers to collect metrics from. If the passed project_ref
59-
/// is not none, it is set as a global label named "project".
57+
/// It also starts listening on an http endpoint at `[::]:9000/metrics`
58+
/// for scrapers to collect metrics from. This listens on all IPv4 and IPv6 interfaces.
59+
/// If the passed project_ref is not none, it is set as a global label named "project".
6060
pub fn init_metrics(project_ref: Option<String>) -> Result<(), BuildError> {
61-
let mut builder = PrometheusBuilder::new();
61+
let mut builder = PrometheusBuilder::new().with_http_listener(std::net::SocketAddr::new(
62+
std::net::IpAddr::V6(std::net::Ipv6Addr::UNSPECIFIED),
63+
9000,
64+
));
6265

6366
if let Some(project_ref) = project_ref {
6467
builder = builder.add_global_label("project", project_ref);

0 commit comments

Comments
 (0)