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

subscriber: look at event parents to determine resource id #114

Merged
merged 2 commits into from Sep 6, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 16 additions & 9 deletions console-subscriber/src/lib.rs
Expand Up @@ -403,8 +403,8 @@ where
}
// else unknown waker event... what to do? can't trace it from here...
} else if self.poll_op_callsites.contains(event.metadata()) {
match ctx.current_span().id() {
Some(resource_id) if self.is_id_resource(resource_id, &ctx) => {
match ctx.event_span(event) {
Some(resource_span) if self.is_resource(resource_span.metadata()) => {
let mut poll_op_visitor = PollOpVisitor::default();
event.record(&mut poll_op_visitor);
if let Some((op_name, is_ready)) = poll_op_visitor.result() {
Expand All @@ -422,21 +422,28 @@ where
self.send(Event::PollOp {
metadata,
at,
resource_id: resource_id.clone(),
resource_id: resource_span.id(),
op_name,
async_op_id,
task_id,
is_ready,
});
} else {
eprintln!(
"poll op event should be emitted in the context of an async op and task spans: {:?}",
event
)
}
// else poll op event should be emitted in the context of an async op and task spans
}
}
_ => {} // poll op event should be emitted in the context of a resource span
_ => eprintln!(
"poll op event should have a resource span parent: {:?}",
event
),
}
} else if self.state_update_callsites.contains(event.metadata()) {
match ctx.current_span().id() {
Some(resource_id) if self.is_id_resource(resource_id, &ctx) => {
match ctx.event_span(event) {
Some(resource_span) if self.is_resource(resource_span.metadata()) => {
let meta_id = event.metadata().into();
let mut state_update_visitor = StateUpdateVisitor::new(meta_id);
event.record(&mut state_update_visitor);
Expand All @@ -445,13 +452,13 @@ where
self.send(Event::StateUpdate {
metadata,
at,
resource_id: resource_id.clone(),
resource_id: resource_span.id(),
update,
});
}
}
_ => eprintln!(
"state update event should be emitted in the context of a resource span: {:?}",
"state update event should have a resource span parent: {:?}",
event
),
}
Expand Down