Skip to content

Commit 4654c64

Browse files
committed
Add tracing spans for output gate wait
1 parent 4bd3b24 commit 4654c64

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/workerd/io/io-gate.c++

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,11 @@ kj::Own<kj::PromiseFulfiller<void>> OutputGate::lock() {
324324
return kj::mv(paf.fulfiller);
325325
}
326326

327-
kj::Promise<void> OutputGate::wait() {
327+
kj::Promise<void> OutputGate::wait(SpanParent parentSpan) {
328328
hooks.outputGateWaiterAdded();
329+
SpanBuilder waitSpan = parentSpan.newChild("output_gate_lock_wait"_kjc);
329330
return pastLocksPromise.addBranch().attach(
330-
kj::defer([this]() { hooks.outputGateWaiterRemoved(); }));
331+
kj::defer([this]() { hooks.outputGateWaiterRemoved(); }), kj::mv(waitSpan));
331332
}
332333

333334
kj::Promise<void> OutputGate::onBroken() {

src/workerd/io/io-gate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ class OutputGate {
275275

276276
// Wait until all preceding locks are released. The wait will not be affected by any future
277277
// call to `lockWhile()`.
278-
kj::Promise<void> wait();
278+
kj::Promise<void> wait(SpanParent parentSpan = nullptr);
279279

280280
// Rejects if and when calls to `wait()` become broken due to a failed lockWhile(). The actor
281281
// should be shut down in this case. This promise never resolves, only rejects.

0 commit comments

Comments
 (0)