Skip to content

Commit

Permalink
Fix parsing IPv6 addresses
Browse files Browse the repository at this point in the history
Fixes #4
  • Loading branch information
asomers-ax committed Aug 17, 2021
1 parent c74b915 commit d4c7218
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use prometheus_exporter::{
};
use std::{
convert::TryInto,
net::SocketAddr
net::{IpAddr, SocketAddr}
};

mod nfs;
Expand Down Expand Up @@ -60,11 +60,11 @@ fn main() {
Builder::from_env(Env::default().default_filter_or("info")).init();

// Parse address used to bind exporter to.
let addr_raw = format!("{}:{}", addr, port);
let addr: SocketAddr = addr_raw.parse().expect("can not parse listen addr");
let ia: IpAddr = addr.parse().unwrap();
let sa = SocketAddr::new(ia, port.parse().unwrap());

// Start exporter.
let (request_receiver, finished_sender) = PrometheusExporter::run_and_notify(addr);
let (request_receiver, finished_sender) = PrometheusExporter::run_and_notify(sa);

// Create metrics
// Even though these are gauge, we use the Gauge API since the kernel
Expand Down

0 comments on commit d4c7218

Please sign in to comment.