diff --git a/metrics-exporter-tcp/Cargo.toml b/metrics-exporter-tcp/Cargo.toml index 45105e6c..ccd00a48 100644 --- a/metrics-exporter-tcp/Cargo.toml +++ b/metrics-exporter-tcp/Cargo.toml @@ -20,13 +20,13 @@ keywords = ["metrics", "telemetry", "tcp"] metrics = { version = "^0.21", path = "../metrics" } bytes = { version = "1", default-features = false } crossbeam-channel = { version = "0.5", default-features = false, features = ["std"] } -prost = { version = "0.11", default-features = false } -prost-types = { version = "0.11", default-features = false, features = ["std"] } +prost = { version = "0.12", default-features = false } +prost-types = { version = "0.12", default-features = false, features = ["std"] } mio = { version = "0.8", default-features = false, features = ["os-poll", "net"] } tracing = { version = "0.1", default-features = false, features = ["attributes"] } [build-dependencies] -prost-build = "0.11" +prost-build = "0.12" home = "=0.5.5" [dev-dependencies] diff --git a/metrics-observer/Cargo.toml b/metrics-observer/Cargo.toml index 6dad4911..17594281 100644 --- a/metrics-observer/Cargo.toml +++ b/metrics-observer/Cargo.toml @@ -21,12 +21,12 @@ metrics = { version = "^0.21", path = "../metrics", default-features = false } metrics-util = { version = "^0.15", path = "../metrics-util", default-features = false, features = ["summary"] } bytes = { version = "1", default-features = false } crossbeam-channel = { version = "0.5", default-features = false, features = ["std"] } -prost = { version = "0.11", default-features = false } -prost-types = { version = "0.11", default-features = false } +prost = { version = "0.12", default-features = false } +prost-types = { version = "0.12", default-features = false } tui = { version = "0.19", default-features = false, features = ["termion"] } termion = { version = "2", default-features = false } chrono = { version = "0.4", default-features = false, features = ["clock"] } [build-dependencies] -prost-build = "0.11" +prost-build = "0.12" home = "=0.5.5" diff --git a/metrics-observer/src/metrics.rs b/metrics-observer/src/metrics.rs index af5c8e72..59d78032 100644 --- a/metrics-observer/src/metrics.rs +++ b/metrics-observer/src/metrics.rs @@ -1,10 +1,13 @@ -use std::collections::{BTreeMap, HashMap}; use std::io::Read; use std::net::TcpStream; use std::net::ToSocketAddrs; use std::sync::{Arc, Mutex, RwLock}; use std::thread; use std::time::Duration; +use std::{ + collections::{BTreeMap, HashMap}, + convert::TryFrom as _, +}; use bytes::{BufMut, BytesMut}; use prost::Message; @@ -178,7 +181,7 @@ impl Runner { match event { Event::Metadata(metadata) => { - let metric_type = MetricType::from_i32(metadata.metric_type) + let metric_type = MetricType::try_from(metadata.metric_type) .expect("unknown metric type over wire"); let metric_kind = match metric_type { MetricType::Counter => MetricKind::Counter,