1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-22 22:42:48 +03:00

deps: update metrics from 0.12 -> 0.14

This commit is contained in:
Wez Furlong 2021-02-03 23:50:29 -08:00
parent bee88d0732
commit d9275e110c
13 changed files with 58 additions and 36 deletions

21
Cargo.lock generated
View File

@ -1998,18 +1998,27 @@ dependencies = [
[[package]]
name = "metrics"
version = "0.12.1"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51b70227ece8711a1aa2f99655efd795d0cff297a5b9fe39645a93aacf6ad39d"
checksum = "ee607b70506ed8dbabe467f24ce0a4d0568980993f94c0a7652d2d50e8b51fd1"
dependencies = [
"metrics-core",
"metrics-macros",
"proc-macro-hack",
]
[[package]]
name = "metrics-core"
version = "0.5.2"
name = "metrics-macros"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c064b3a1ff41f4bf6c91185c8a0caeccf8a8a27e9d0f92cc54cf3dbec812f48"
checksum = "11ac60cd4d3a869fd39d57baf0ed7f79fb677580d8d6655c4330d4f1126bc27b"
dependencies = [
"lazy_static",
"proc-macro-hack",
"proc-macro2",
"quote 1.0.8",
"regex",
"syn 1.0.60",
]
[[package]]
name = "miniz_oxide"

View File

@ -11,7 +11,7 @@ anyhow = "1.0"
config = { path = "../config" }
leb128 = "0.2"
log = "0.4"
metrics = { version="0.12", features=["std"]}
metrics = { version="0.14", features=["std"]}
mux = { path = "../mux" }
portable-pty = { path = "../pty", features = ["serde_support"]}
rangeset = { path = "../rangeset" }

View File

@ -73,9 +73,9 @@ fn encode_raw_as_vec(
buffer.extend_from_slice(data);
if is_compressed {
metrics::value!("pdu.encode.compressed.size", buffer.len() as u64);
metrics::histogram!("pdu.encode.compressed.size", buffer.len() as f64);
} else {
metrics::value!("pdu.encode.size", buffer.len() as u64);
metrics::histogram!("pdu.encode.size", buffer.len() as f64);
}
Ok(buffer)
@ -188,9 +188,9 @@ async fn decode_raw_async<R: Unpin + AsyncRead + std::fmt::Debug>(
};
if is_compressed {
metrics::value!("pdu.decode.compressed.size", data_len as u64);
metrics::histogram!("pdu.decode.compressed.size", data_len as f64);
} else {
metrics::value!("pdu.decode.size", data_len as u64);
metrics::histogram!("pdu.decode.size", data_len as f64);
}
let mut data = vec![0u8; data_len];
@ -235,9 +235,9 @@ fn decode_raw<R: std::io::Read>(mut r: R) -> anyhow::Result<Decoded> {
};
if is_compressed {
metrics::value!("pdu.decode.compressed.size", data_len as u64);
metrics::histogram!("pdu.decode.compressed.size", data_len as f64);
} else {
metrics::value!("pdu.decode.size", data_len as u64);
metrics::histogram!("pdu.decode.size", data_len as f64);
}
let mut data = vec![0u8; data_len];
@ -325,7 +325,7 @@ macro_rules! pdu {
Pdu::$name(s) => {
let (data, is_compressed) = serialize(s)?;
let encoded_size = encode_raw($vers, serial, &data, is_compressed, w)?;
metrics::value!("pdu.size", encoded_size as u64, "pdu" => stringify!($name));
metrics::histogram!("pdu.size", encoded_size as f64, "pdu" => stringify!($name));
Ok(())
}
,)*
@ -339,7 +339,7 @@ macro_rules! pdu {
Pdu::$name(s) => {
let (data, is_compressed) = serialize(s)?;
let encoded_size = encode_raw_async($vers, serial, &data, is_compressed, w).await?;
metrics::value!("pdu.size", encoded_size as u64, "pdu" => stringify!($name));
metrics::histogram!("pdu.size", encoded_size as f64, "pdu" => stringify!($name));
Ok(())
}
,)*
@ -351,7 +351,7 @@ macro_rules! pdu {
match decoded.ident {
$(
$vers => {
metrics::value!("pdu.size", decoded.data.len() as u64, "pdu" => stringify!($name));
metrics::histogram!("pdu.size", decoded.data.len() as f64, "pdu" => stringify!($name));
Ok(DecodedPdu {
serial: decoded.serial,
pdu: Pdu::$name(deserialize(decoded.data.as_slice(), decoded.is_compressed)?)
@ -359,7 +359,7 @@ macro_rules! pdu {
}
,)*
_ => {
metrics::value!("pdu.size", decoded.data.len() as u64, "pdu" => "??");
metrics::histogram!("pdu.size", decoded.data.len() as f64, "pdu" => "??");
Ok(DecodedPdu {
serial: decoded.serial,
pdu: Pdu::Invalid{ident:decoded.ident}
@ -377,7 +377,7 @@ macro_rules! pdu {
match decoded.ident {
$(
$vers => {
metrics::value!("pdu.size", decoded.data.len() as u64, "pdu" => stringify!($name));
metrics::histogram!("pdu.size", decoded.data.len() as f64, "pdu" => stringify!($name));
Ok(DecodedPdu {
serial: decoded.serial,
pdu: Pdu::$name(deserialize(decoded.data.as_slice(), decoded.is_compressed)?)
@ -385,7 +385,7 @@ macro_rules! pdu {
}
,)*
_ => {
metrics::value!("pdu.size", decoded.data.len() as u64, "pdu" => "??");
metrics::histogram!("pdu.size", decoded.data.len() as f64, "pdu" => "??");
Ok(DecodedPdu {
serial: decoded.serial,
pdu: Pdu::Invalid{ident:decoded.ident}

View File

@ -28,7 +28,7 @@ lru = "0.6"
termwiz = { path = "../termwiz" }
filedescriptor = { version="0.7", path = "../filedescriptor" }
futures = "0.3"
metrics = { version="0.12", features=["std"]}
metrics = { version="0.14", features=["std"]}
textwrap = "0.13"
[target."cfg(windows)".dependencies]

View File

@ -65,7 +65,7 @@ macro_rules! rpc {
let start = std::time::Instant::now();
let result = self.send_pdu(Pdu::$request_type(pdu)).await;
let elapsed = start.elapsed();
metrics::value!("rpc", elapsed, "method" => stringify!($method_name));
metrics::histogram!("rpc", elapsed, "method" => stringify!($method_name));
match result {
Ok(Pdu::$response_type(res)) => Ok(res),
Ok(_) => bail!("unexpected response {:?}", result),
@ -83,7 +83,7 @@ macro_rules! rpc {
let start = std::time::Instant::now();
let result = self.send_pdu(Pdu::$request_type($request_type{})).await;
let elapsed = start.elapsed();
metrics::value!("rpc", elapsed, "method" => stringify!($method_name));
metrics::histogram!("rpc", elapsed, "method" => stringify!($method_name));
match result {
Ok(Pdu::$response_type(res)) => Ok(res),
Ok(_) => bail!("unexpected response {:?}", result),

View File

@ -15,7 +15,7 @@ freetype = { path = "../deps/freetype" }
harfbuzz = { path = "../deps/harfbuzz" }
lazy_static = "1.4"
log = "0.4"
metrics = { version="0.12", features=["std"]}
metrics = { version="0.14", features=["std"]}
mux = { path = "../mux" }
ordered-float = "2.0"
rangeset = { path = "../rangeset" }

View File

@ -55,7 +55,7 @@ impl Entry {
let t = std::time::Instant::now();
coverage.replace(self.compute_coverage()?);
let elapsed = t.elapsed();
metrics::value!("font.compute.codepoint.coverage", elapsed);
metrics::histogram!("font.compute.codepoint.coverage", elapsed);
log::debug!(
"{} codepoint coverage computed in {:?}",
self.names.full_name,

View File

@ -335,7 +335,7 @@ impl FontShaper for HarfbuzzShaper {
) -> anyhow::Result<Vec<GlyphInfo>> {
let start = std::time::Instant::now();
let result = self.do_shape(0, text, size, dpi, no_glyphs);
metrics::value!("shape.harfbuzz", start.elapsed());
metrics::histogram!("shape.harfbuzz", start.elapsed());
/*
if let Ok(glyphs) = &result {
for g in glyphs {

View File

@ -31,7 +31,7 @@ libc = "0.2"
log = "0.4"
lru = "0.6"
luahelper = { path = "../luahelper" }
metrics = { version="0.12", features=["std"]}
metrics = { version="0.14", features=["std"]}
mlua = "0.5"
mux = { path = "../mux" }
open = "1.4"

View File

@ -841,7 +841,7 @@ impl WindowCallbacks for TermWindow {
self.call_draw(frame).ok();
log::debug!("paint_pane_opengl elapsed={:?}", start.elapsed());
metrics::value!("gui.paint.opengl", start.elapsed());
metrics::histogram!("gui.paint.opengl", start.elapsed());
self.update_title();
}
}

View File

@ -1,6 +1,6 @@
use config::configuration;
use hdrhistogram::Histogram;
use metrics::{Key, Recorder};
use metrics::{GaugeValue, Key, Recorder, Unit};
use std::collections::HashMap;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
@ -54,7 +54,7 @@ impl Inner {
let inner = inner.lock().unwrap();
let mut data = vec![];
for (key, histogram) in &inner.histograms {
if key.name().ends_with(".size") {
if key.to_string().ends_with(".size") {
let p50 = histogram.value_at_percentile(50.);
let p75 = histogram.value_at_percentile(75.);
let p95 = histogram.value_at_percentile(95.);
@ -109,20 +109,33 @@ impl Stats {
}
impl Recorder for Stats {
fn register_counter(&self, _key: Key, _unit: Option<Unit>, _description: Option<&'static str>) {
}
fn register_gauge(&self, _key: Key, _unit: Option<Unit>, _description: Option<&'static str>) {}
fn register_histogram(
&self,
_key: Key,
_unit: Option<Unit>,
_description: Option<&'static str>,
) {
}
fn increment_counter(&self, key: Key, value: u64) {
log::trace!("counter '{}' -> {}", key, value);
}
fn update_gauge(&self, key: Key, value: i64) {
log::trace!("gauge '{}' -> {}", key, value);
fn update_gauge(&self, key: Key, value: GaugeValue) {
log::trace!("gauge '{}' -> {:?}", key, value);
}
fn record_histogram(&self, key: Key, value: u64) {
fn record_histogram(&self, key: Key, value: f64) {
let mut inner = self.inner.lock().unwrap();
let histogram = inner
.histograms
.entry(key)
.or_insert_with(|| Histogram::new(2).expect("failed to crate new Histogram"));
histogram.record(value).ok();
histogram.record(value as u64).ok();
}
}

View File

@ -25,7 +25,7 @@ lazy_static = "1.4"
libloading = "0.6"
line_drawing = "0.8"
log = "0.4"
metrics = { version="0.12", features=["std"]}
metrics = { version="0.14", features=["std"]}
palette = "0.5"
promise = { path = "../promise" }
resize = "0.5"

View File

@ -70,10 +70,10 @@ impl SpawnQueue {
// returned function
fn pop_func(&self) -> Option<SpawnFunc> {
if let Some(func) = self.spawned_funcs.lock().unwrap().pop_front() {
metrics::value!("executor.spawn_delay", func.at.elapsed());
metrics::histogram!("executor.spawn_delay", func.at.elapsed());
Some(func.func)
} else if let Some(func) = self.spawned_funcs_low_pri.lock().unwrap().pop_front() {
metrics::value!("executor.spawn_delay.low_pri", func.at.elapsed());
metrics::histogram!("executor.spawn_delay.low_pri", func.at.elapsed());
Some(func.func)
} else {
None