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

Streaming Trace, Part 2: simplify PipelineTracer to remove parentTracer #2925

Open
wants to merge 28 commits into
base: jsnell/stream-trace-workers-part-1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fd3a1b9
Start restructuring the io/trace.h to prepare for streaming trace
jasnell Sep 30, 2024
4be33dc
Collect trace onset metadata into a separate struct
jasnell Sep 30, 2024
c77720d
Move FetchEventInfo to trace-common w/ minor cleanups
jasnell Sep 30, 2024
0bff873
Move several trace info structs to trace-common.h
jasnell Sep 30, 2024
df350c8
Move more trace info structs to trace-common.h
jasnell Sep 30, 2024
bb257f2
Move trace event type definitions o trace-common.h
jasnell Sep 30, 2024
14913a6
Move Trace impl to trace-legacy.c++
jasnell Sep 30, 2024
02bf2fe
Additional minor cleanups
jasnell Sep 30, 2024
400dee8
Consolidate outcome setters to a single setOutcomeInfo
jasnell Sep 30, 2024
3c1540b
Move more legacy in-memory trace code to trace-legacy.{c++,h}.
jasnell Sep 30, 2024
6a240e2
Use trace: namespace directly for common types
jasnell Sep 30, 2024
a9881e9
Add initial scaffolding for new StreamingTrace class
jasnell Sep 30, 2024
5e76630
Remove deprecated trace-legacy.h aliases
jasnell Sep 30, 2024
e941745
More implementation detail for streaming trace
jasnell Oct 1, 2024
24503ba
Initial tail worker support in workerd
jasnell Oct 4, 2024
c687e6b
Add streaming tail workers autogate
jasnell Oct 4, 2024
acc4439
More cleanups and refinements on revised trace api
jasnell Oct 7, 2024
cd8f4d8
Additional fixuups after resolving merge conflicts
jasnell Oct 11, 2024
939c8ab
Fixup comment position in capnp
jasnell Oct 15, 2024
0c590f4
Remove accountId and stableId from the schema
jasnell Oct 15, 2024
38ef60b
s/gate open/gate closed
jasnell Oct 15, 2024
b0a3df6
Limit streaming trace metrics struct to float
jasnell Oct 15, 2024
5a1bcb1
Remove the unit field in Metric struct
jasnell Oct 15, 2024
cc46604
Updates based on feedback
jasnell Oct 16, 2024
3d7994a
Remove unnecessary kj::Date argument
jasnell Oct 16, 2024
fb23d06
Remove the transactional flag for trace spans
jasnell Oct 16, 2024
219cd0b
Flatten the StreamEvent structure more
jasnell Oct 16, 2024
d9ff07e
Simplify PipelineTracer
jasnell Oct 15, 2024
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
25 changes: 25 additions & 0 deletions samples/tail-worker/config.capnp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Workerd = import "/workerd/workerd.capnp";

const tailWorkerExample :Workerd.Config = (
services = [
(name = "main", worker = .helloWorld),
(name = "log", worker = .logWorker),
],

sockets = [ ( name = "http", address = "*:8080", http = (), service = "main" ) ]
);

const helloWorld :Workerd.Worker = (
modules = [
(name = "worker", esModule = embed "worker.js")
],
compatibilityDate = "2023-02-28",
logging = ( toService = "log" ),
);

const logWorker :Workerd.Worker = (
modules = [
(name = "worker", esModule = embed "tail.js")
],
compatibilityDate = "2023-02-28",
);
9 changes: 9 additions & 0 deletions samples/tail-worker/tail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) 2017-2023 Cloudflare, Inc.
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
// https://opensource.org/licenses/Apache-2.0

export default {
tail(traces) {
console.log(traces);
}
};
9 changes: 9 additions & 0 deletions samples/tail-worker/worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) 2017-2023 Cloudflare, Inc.
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
// https://opensource.org/licenses/Apache-2.0

export default {
async fetch(req, env) {
return new Response("Hello World\n");
}
};
14 changes: 7 additions & 7 deletions src/workerd/api/hibernatable-web-socket.c++
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,27 @@ kj::Promise<WorkerInterface::CustomEvent::Result> HibernatableWebSocketCustomEve
auto eventParameters = consumeParams();

KJ_IF_SOME(t, incomingRequest->getWorkerTracer()) {
Trace::HibernatableWebSocketEventInfo::Type type =
[&]() -> Trace::HibernatableWebSocketEventInfo::Type {
trace::HibernatableWebSocketEventInfo::Type type =
[&]() -> trace::HibernatableWebSocketEventInfo::Type {
KJ_SWITCH_ONEOF(eventParameters.eventType) {
KJ_CASE_ONEOF(_, HibernatableSocketParams::Text) {
return Trace::HibernatableWebSocketEventInfo::Message{};
return trace::HibernatableWebSocketEventInfo::Message{};
}
KJ_CASE_ONEOF(data, HibernatableSocketParams::Data) {
return Trace::HibernatableWebSocketEventInfo::Message{};
return trace::HibernatableWebSocketEventInfo::Message{};
}
KJ_CASE_ONEOF(close, HibernatableSocketParams::Close) {
return Trace::HibernatableWebSocketEventInfo::Close{
return trace::HibernatableWebSocketEventInfo::Close{
.code = close.code, .wasClean = close.wasClean};
}
KJ_CASE_ONEOF(_, HibernatableSocketParams::Error) {
return Trace::HibernatableWebSocketEventInfo::Error{};
return trace::HibernatableWebSocketEventInfo::Error{};
}
}
KJ_UNREACHABLE;
}();

t.setEventInfo(context.now(), Trace::HibernatableWebSocketEventInfo(kj::mv(type)));
t.setEventInfo(context.now(), trace::HibernatableWebSocketEventInfo(kj::mv(type)));
}

try {
Expand Down
2 changes: 1 addition & 1 deletion src/workerd/api/queue.c++
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ kj::Promise<WorkerInterface::CustomEvent::Result> QueueCustomEventImpl::run(
}

KJ_IF_SOME(t, incomingRequest->getWorkerTracer()) {
t.setEventInfo(context.now(), Trace::QueueEventInfo(kj::mv(queueName), batchSize));
t.setEventInfo(context.now(), trace::QueueEventInfo(kj::mv(queueName), batchSize));
}

// Create a custom refcounted type for holding the queueEvent so that we can pass it to the
Expand Down
Loading