Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console: fix task lookup in async ops view #257

Merged
merged 2 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions console/src/state/async_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,17 @@ impl AsyncOpsState {
self.async_ops.values().map(Rc::downgrade)
}

// Clippy warns us that having too many arguments is bad style. In this case, however
// it does not make much sense to group any of them.
#[allow(clippy::too_many_arguments)]
pub(crate) fn update_async_ops(
&mut self,
styles: &view::Styles,
strings: &mut intern::Strings,
metas: &HashMap<u64, Metadata>,
update: proto::async_ops::AsyncOpUpdate,
resource_ids: &mut Ids,
task_ids: &mut Ids,
visibility: Visibility,
) {
let mut stats_update = update.stats_update;
Expand Down Expand Up @@ -155,8 +159,13 @@ impl AsyncOpsState {
};

let span_id = async_op.id?.id;
let stats =
AsyncOpStats::from_proto(stats_update.remove(&span_id)?, meta, styles, strings);
let stats = AsyncOpStats::from_proto(
stats_update.remove(&span_id)?,
meta,
styles,
strings,
task_ids,
);

let num = self.ids.id_for(span_id);
let resource_id = resource_ids.id_for(async_op.resource_id?.id);
Expand Down Expand Up @@ -187,7 +196,8 @@ impl AsyncOpsState {
if let Some(async_op) = self.async_ops.get_mut(&num) {
let mut async_op = async_op.borrow_mut();
if let Some(meta) = metas.get(&async_op.meta_id) {
async_op.stats = AsyncOpStats::from_proto(stats, meta, styles, strings);
async_op.stats =
AsyncOpStats::from_proto(stats, meta, styles, strings, task_ids);
}
}
}
Expand Down Expand Up @@ -275,6 +285,7 @@ impl AsyncOpStats {
meta: &Metadata,
styles: &view::Styles,
strings: &mut intern::Strings,
task_ids: &mut Ids,
) -> Self {
let mut pb = pb;

Expand Down Expand Up @@ -304,7 +315,7 @@ impl AsyncOpStats {
let busy = poll_stats.busy_time.map(pb_duration).unwrap_or_default();
let idle = total.map(|total| total - busy);
let formatted_attributes = Attribute::make_formatted(styles, &mut attributes);
let task_id = pb.task_id.map(|id| id.id);
let task_id = pb.task_id.map(|id| task_ids.id_for(id.id));
let task_id_str = strings.string(
task_id
.as_ref()
Expand Down
1 change: 1 addition & 0 deletions console/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ impl State {
&self.metas,
async_ops_update,
&mut self.resources_state.ids,
&mut self.tasks_state.ids,
visibility,
)
}
Expand Down