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

add PassthroughTraceWorker definitions #3156

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
8 changes: 4 additions & 4 deletions src/workerd/io/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -584,11 +584,11 @@ class BaseTracer {
kj::Date timestamp, kj::String channel, kj::Array<kj::byte> message) = 0;

// Adds info about the event that triggered the trace. Must not be called more than once.
virtual void setEventInfo(kj::Date timestamp, tracing::EventInfo&&) = 0;
virtual void setEventInfo(kj::Date timestamp, tracing::EventInfo&& info) = 0;

// Adds info about the response. Must not be called more than once, and only
// after passing a FetchEventInfo to setEventInfo().
virtual void setFetchResponseInfo(tracing::FetchResponseInfo&&) = 0;
virtual void setFetchResponseInfo(tracing::FetchResponseInfo&& info) = 0;

virtual void setOutcome(EventOutcome outcome, kj::Duration cpuTime, kj::Duration wallTime) = 0;
};
Expand Down Expand Up @@ -617,8 +617,8 @@ class WorkerTracer final: public kj::Refcounted, public BaseTracer {
kj::Maybe<kj::String> stack) override;
void addDiagnosticChannelEvent(
kj::Date timestamp, kj::String channel, kj::Array<kj::byte> message) override;
void setEventInfo(kj::Date timestamp, tracing::EventInfo&&) override;
void setFetchResponseInfo(tracing::FetchResponseInfo&&) override;
void setEventInfo(kj::Date timestamp, tracing::EventInfo&& info) override;
void setFetchResponseInfo(tracing::FetchResponseInfo&& info) override;
void setOutcome(EventOutcome outcome, kj::Duration cpuTime, kj::Duration wallTime) override;

// Used only for a Trace in a process sandbox. Copies the content of this tracer's trace to the
Expand Down
25 changes: 25 additions & 0 deletions src/workerd/io/worker-interface.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -486,3 +486,28 @@ interface WorkerdBootstrap {
# TODO(someday): Pass cfBlobJson? Currently doesn't matter since the cf blob is only present for
# HTTP requests which can be delivered over regular HTTP instead of capnp.
}

interface PassthroughTraceWorker {
struct EventInfo {
union {
fetch @0 :Trace.FetchEventInfo;
jsRpc @1 :Trace.JsRpcEventInfo;
scheduled @2 :Trace.ScheduledEventInfo;
alarm @3 :Trace.AlarmEventInfo;
queue @4 :Trace.QueueEventInfo;
custom @5 :Trace.CustomEventInfo;
email @6 :Trace.EmailEventInfo;
trace @7 :Trace.TraceEventInfo;
hibernatableWebSocket @8 :Trace.HibernatableWebSocketEventInfo;
}
}

setEventInfo @0 (timestampNs :Int64, eventInfo :EventInfo);
addLog @1 (timestampNs :Int64, logLevel :Trace.Log.Level, message :Text, isSpan :Bool);
addException @2 (timestampNs :Int64, name :Text, message :Text, stack :Text = null);
addDiagnosticChannelEvent @3 (timestampNs :Int64, channel :Text, message :Data);
setFetchResponseInfo @4 (info :Trace.FetchResponseInfo);
setOutcome @5 (outcome :EventOutcome, cpuTime :UInt64, wallTime :UInt64);
# TODO(soon): Uncomment when Span definitions exist in workerd.
# addSpan @2 (span :TraceCollector.Span, spanContext :Text);
}