Skip to content

Commit

Permalink
console: fix missing histogram in task details (tokio-rs#269)
Browse files Browse the repository at this point in the history
Task `Details` are tracked by the remote's `span::Id` while the
`Task::id()` is the friendly id.

The comparison in the view is changed to use the remote span ids and the
field in `Details` is renamed to match.

Fixes: tokio-rs#262
  • Loading branch information
jtgeibel authored Jan 28, 2022
1 parent e7b228d commit 884f4ec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tokio-console/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl State {
pub(crate) fn update_task_details(&mut self, update: proto::tasks::TaskDetails) {
if let Some(id) = update.task_id {
let details = Details {
task_id: id.id,
span_id: id.id,
poll_times_histogram: update.poll_times_histogram.and_then(|data| {
hdrhistogram::serialization::Deserializer::new()
.deserialize(&mut Cursor::new(&data))
Expand Down
6 changes: 3 additions & 3 deletions tokio-console/src/state/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub(crate) struct TasksState {

#[derive(Debug, Default)]
pub(crate) struct Details {
pub(crate) task_id: u64,
pub(crate) span_id: u64,
pub(crate) poll_times_histogram: Option<Histogram<u64>>,
}

Expand Down Expand Up @@ -223,8 +223,8 @@ impl TasksState {
}

impl Details {
pub(crate) fn task_id(&self) -> u64 {
self.task_id
pub(crate) fn span_id(&self) -> u64 {
self.span_id
}

pub(crate) fn poll_times_histogram(&self) -> Option<&Histogram<u64>> {
Expand Down
2 changes: 1 addition & 1 deletion tokio-console/src/view/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl TaskView {
let details_ref = self.details.borrow();
let details = details_ref
.as_ref()
.filter(|details| details.task_id() == task.id());
.filter(|details| details.span_id() == task.span_id());

let warnings: Vec<_> = task
.warnings()
Expand Down

0 comments on commit 884f4ec

Please sign in to comment.