Skip to content

Commit b678c73

Browse files
apollo_dashboard: add microseconds units to tokio panels
1 parent 1603a68 commit b678c73

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

crates/apollo_dashboard/resources/dev_grafana.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,7 @@
12701270
"tokio_total_busy_duration{cluster=~\"$cluster\", namespace=~\"$namespace\"}"
12711271
],
12721272
"extra_params": {
1273+
"unit": "µs",
12731274
"legends": [
12741275
"{{pod}}"
12751276
]
@@ -1283,6 +1284,7 @@
12831284
"tokio_min_busy_duration{cluster=~\"$cluster\", namespace=~\"$namespace\"}"
12841285
],
12851286
"extra_params": {
1287+
"unit": "µs",
12861288
"legends": [
12871289
"{{pod}}"
12881290
]
@@ -1296,6 +1298,7 @@
12961298
"tokio_max_busy_duration{cluster=~\"$cluster\", namespace=~\"$namespace\"}"
12971299
],
12981300
"extra_params": {
1301+
"unit": "µs",
12991302
"legends": [
13001303
"{{pod}}"
13011304
]

crates/apollo_dashboard/src/dashboard.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ pub enum Unit {
8080
// The expected values for PercentUnit are [0,1]
8181
PercentUnit,
8282
MB,
83+
Microseconds,
8384
}
8485

8586
impl Unit {
@@ -89,6 +90,7 @@ impl Unit {
8990
Unit::Seconds => "s",
9091
Unit::PercentUnit => "percentunit",
9192
Unit::MB => "decmbytes",
93+
Unit::Microseconds => "µs",
9294
}
9395
}
9496
}

crates/apollo_dashboard/src/panels/tokio.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,25 @@ use apollo_monitoring_endpoint::tokio_metrics::{
99
TOKIO_WORKERS_COUNT,
1010
};
1111

12-
use crate::dashboard::{Panel, PanelType, Row};
12+
use crate::dashboard::{Panel, PanelType, Row, Unit};
1313

1414
// TODO(Matan/Tsabary): Use units for Tokio panels.
1515
const TOKIO_PANEL_LEGENDS: &[&str] = &["{{pod}}"];
1616

1717
fn get_panel_tokio_total_busy_duration_micros() -> Panel {
1818
Panel::from_counter(&TOKIO_TOTAL_BUSY_DURATION_MICROS, PanelType::TimeSeries)
1919
.with_legends(TOKIO_PANEL_LEGENDS.to_vec())
20+
.with_unit(Unit::Microseconds)
2021
}
2122
fn get_panel_tokio_min_busy_duration_micros() -> Panel {
2223
Panel::from_counter(&TOKIO_MIN_BUSY_DURATION_MICROS, PanelType::TimeSeries)
2324
.with_legends(TOKIO_PANEL_LEGENDS.to_vec())
25+
.with_unit(Unit::Microseconds)
2426
}
2527
fn get_panel_tokio_max_busy_duration_micros() -> Panel {
2628
Panel::from_counter(&TOKIO_MAX_BUSY_DURATION_MICROS, PanelType::TimeSeries)
2729
.with_legends(TOKIO_PANEL_LEGENDS.to_vec())
30+
.with_unit(Unit::Microseconds)
2831
}
2932

3033
fn get_panel_tokio_total_park_count() -> Panel {

0 commit comments

Comments
 (0)