Skip to content

Commit 841e8e6

Browse files
committed
core: Better logging of assignment events
In particular, include the deployment hash
1 parent 68ff0d0 commit 841e8e6

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/src/subgraph/registrar.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,32 +173,33 @@ where
173173
anyhow!("Failed to get subgraph assignment entity: {}", e)
174174
})
175175
.map(|assigned| -> Box<dyn Stream<Item = _, Error = _> + Send> {
176+
let logger = logger.new(o!("subgraph_id" => deployment.hash.to_string(), "node_id" => node_id.to_string()));
176177
if let Some((assigned,is_paused)) = assigned {
177178
if assigned == node_id {
178179

179180
if is_paused{
180181
// Subgraph is paused, so we don't start it
181-
debug!(logger, "Deployment assignee is this node, but it is paused, so we don't start it"; "assigned_to" => assigned, "node_id" => &node_id,"paused" => is_paused);
182+
debug!(logger, "Deployment assignee is this node"; "assigned_to" => assigned, "paused" => is_paused, "action" => "ignore");
182183
return Box::new(stream::empty());
183184
}
184185

185186
// Start subgraph on this node
186-
debug!(logger, "Deployment assignee is this node, broadcasting add event"; "assigned_to" => assigned, "node_id" => &node_id);
187+
debug!(logger, "Deployment assignee is this node"; "assigned_to" => assigned, "action" => "add");
187188
Box::new(stream::once(Ok(AssignmentEvent::Add {
188189
deployment,
189190
node_id: node_id.clone(),
190191
})))
191192
} else {
192193
// Ensure it is removed from this node
193-
debug!(logger, "Deployment assignee is not this node, broadcasting remove event"; "assigned_to" => assigned, "node_id" => &node_id);
194+
debug!(logger, "Deployment assignee is not this node"; "assigned_to" => assigned, "action" => "remove");
194195
Box::new(stream::once(Ok(AssignmentEvent::Remove {
195196
deployment,
196197
node_id: node_id.clone(),
197198
})))
198199
}
199200
} else {
200201
// Was added/updated, but is now gone.
201-
debug!(logger, "Deployment has not assignee, we will get a separate remove event later"; "node_id" => &node_id);
202+
debug!(logger, "Deployment assignee not found in database"; "action" => "ignore");
202203
Box::new(stream::empty())
203204
}
204205
})

0 commit comments

Comments
 (0)