Skip to content
Open
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
13 changes: 10 additions & 3 deletions src/workerd/io/trace-stream.c++
Original file line number Diff line number Diff line change
Expand Up @@ -1053,16 +1053,23 @@ struct TailStreamWriterState {
actives.truncate(activeEnd - actives.begin());
}

// We do not expect any events after the outcome.
bool isClosing = event.event.is<Outcome>();
// Deliver the event to the queue and make sure we are processing.
for (auto& active: actives) {
active->queue.push(event.clone());
// Optimization: Elide copy for last tail worker, helpful for common case of only one STW
// being present.
if (&active == &actives.back()) {
active->queue.push(kj::mv(event));
} else {
active->queue.push(event.clone());
}
if (!active->pumping) {
waitUntilTasks.add(pump(kj::addRef(*active)));
}
}

// We do not expect any events after the outcome.
return event.event.is<Outcome>();
return isClosing;
}

// Delivers the queued tail events to a streaming tail worker.
Expand Down
3 changes: 0 additions & 3 deletions src/workerd/io/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -581,9 +581,6 @@ struct Attribute final {
explicit Attribute(kj::ConstString name, Value&& value);
explicit Attribute(kj::ConstString name, Values&& values);

template <AttributeValue V>
explicit Attribute(kj::ConstString name, V v): Attribute(kj::mv(name), Value(kj::mv(v))) {}

template <AttributeValue V>
explicit Attribute(kj::ConstString name, kj::Array<V> vals)
: Attribute(kj::mv(name), KJ_MAP(v, vals) { return Value(kj::mv(v)); }) {}
Expand Down
3 changes: 1 addition & 2 deletions src/workerd/io/tracer.c++
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,7 @@ void WorkerTracer::setJsRpcInfo(const tracing::InvocationSpanContext& context,

KJ_IF_SOME(writer, maybeTailStreamWriter) {
auto tag = tracing::Attribute("jsrpc.method"_kjc, methodName.clone());
kj::Array<tracing::Attribute> attrs(&tag, 1, kj::NullArrayDisposer::instance);
writer->report(context, kj::mv(attrs), timestamp);
writer->report(context, kj::arr(kj::mv(tag)), timestamp);
}
}

Expand Down
Loading