Skip to content

Commit d464745

Browse files
committed
Use count.try_into() as inc_by argument.
The Counter type used by Prometheus is platform specific, e.g. for MIPS it uses a u32 instead of u64. Using try_into() we can make the inc_by argument platform agnostic.
1 parent 34c6a44 commit d464745

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/metrics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub fn incr_udp_sent_bytes(server: &str, typ: &str, count: usize) {
8080
server: server.to_string(),
8181
r#type: typ.to_string(),
8282
})
83-
.inc_by(count as u64);
83+
.inc_by(count.try_into().unwrap());
8484
}
8585

8686
pub fn incr_udp_received_count(server: &str, typ: &str) {
@@ -98,7 +98,7 @@ pub fn incr_udp_received_bytes(server: &str, typ: &str, count: usize) {
9898
server: server.to_string(),
9999
r#type: typ.to_string(),
100100
})
101-
.inc_by(count as u64);
101+
.inc_by(count.try_into().unwrap());
102102
}
103103

104104
fn handle_request(stream: TcpStream) {

0 commit comments

Comments
 (0)