This commit is contained in:
Olivier 'reivilibre' 2021-11-25 09:09:05 +00:00
parent 95a9006681
commit f8e6eea2ff
5 changed files with 2045 additions and 0 deletions

2008
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

7
Cargo.toml Normal file
View File

@ -0,0 +1,7 @@
[workspace]
members = [
"bare-metrics-core",
"bare-metrics-gui",
"bare-metrics-recorder",
"bare-metrics-reader"
]

1
bare-metrics-gui/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

View File

@ -0,0 +1,18 @@
[package]
name = "bare-metrics-gui"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bare-metrics-core = { version = "0.1.0", path = "../bare-metrics-core" }
# not needed? bare-metrics-recorder = { version = "0.1.0", path = "../bare-metrics-recorder" }
bare-metrics-reader = { version = "0.1.0", path = "../bare-metrics-reader" }
eframe = "0.15.0"
emath = "0.15.0"
egui = "0.15.0"
log = "0.4.14"
env_logger = "0.9.0"
anyhow = "1.0.48"
hdrhistogram = "7.4.0"

View File

@ -99,6 +99,8 @@ impl<W: Write + Send + 'static> BareMetricsRecorderCore<W> {
metric_kind,
unit,
description,
name,
labels,
}) => {
self.next_frame.new_metrics.insert(
metric_id,
@ -106,6 +108,8 @@ impl<W: Write + Send + 'static> BareMetricsRecorderCore<W> {
kind: metric_kind,
unit: unit.map(|unit| unit.as_str().to_string()),
description: description.to_string(),
name,
labels,
},
);
self.known_metric_kinds.insert(metric_id, metric_kind);
@ -214,6 +218,8 @@ pub enum RecorderMessage {
metric_kind: MetricKind,
unit: Option<Unit>,
description: &'static str,
name: String,
labels: HashMap<String, String>,
},
HistogramReading {
metric_id: MetricId,
@ -258,6 +264,11 @@ impl BareMetricsRecorderShard {
metric_kind,
unit,
description: description.unwrap_or(""),
name: key.name().to_string(),
labels: key
.labels()
.map(|l| (l.key().to_string(), l.value().to_string()))
.collect::<HashMap<String, String>>(),
};
if let Err(e) = self.recorder_tx.send(registration) {