Skip to content

EW-9282 EW-9367 Add STW onset event size limit #4809

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fhanau
Copy link
Contributor

@fhanau fhanau commented Aug 18, 2025

We need to institute some limits on the size of streaming tail worker events, start with the Onset event. Size is counted the same way it is counted for the LTW so far, so some kinds of metadata are not included in it.
This also fixes a subtle bug where we would not dispatch the onset for STW at all if it was too big, which caused errors to be logged when trying to dispatch later events.

We need to institute some limits on the size of streaming tail worker events,
start with the Onset event. Size is counted the same way it is counted for the
LTW so far, so some kinds of metadata are not included in it.
This also fixes a subtle bug where we would not dispatch the onset for STW at
all if it was too big, which caused errors to be logged when trying to dispatch
later events.
@fhanau fhanau requested a review from mar-cf August 18, 2025 14:42
@fhanau fhanau requested review from a team as code owners August 18, 2025 14:42
trace->truncated = true;
eventSize += fetch.cfJson.size();
if (trace->bytesUsed + eventSize > MAX_TRACE_BYTES) {
trace->truncated = truncated = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: prefer one statement per line

trace->logs.add(timestamp, LogLevel::WARN,
kj::str("[\"Trace resource limit exceeded; could not capture event info.\"]"));
trace->eventInfo = tracing::FetchEventInfo(fetch.method, {}, {}, {});
return;
// Limit STW onset to MAX_TRACE_BYTES, beyond that dispatch a truncated event too.
if (eventSize > MAX_TRACE_BYTES) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth to include a short lived, periodic log to figure out if or how often this occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants