Skip to content

EW-9282 EW-9451 Fix missing onset event for JSRpc edge cases, add JSRpc regression test#4881

Merged
fhanau merged 2 commits intomainfrom
felix/082325-missing-onset-fix
Aug 26, 2025
Merged

EW-9282 EW-9451 Fix missing onset event for JSRpc edge cases, add JSRpc regression test#4881
fhanau merged 2 commits intomainfrom
felix/082325-missing-onset-fix

Conversation

@fhanau
Copy link
Copy Markdown
Contributor

@fhanau fhanau commented Aug 23, 2025

EW-9282 EW-9451 Fix missing onset event for JSRpc edge cases
If we invoke a customEvent, we should generally report an onset event to the tracer right away. Under the STW model, we must do so if there's any chance for events like spans/logs being generated from JS (this wasn't the case with LTW so far).
For JSRPC, we would only create an onset event after we were able to successfully get a function or property to call, but we may invoke JS code before that (e.g. if a JS getter method produced a log). Accordingly, set the onset as soon as we know the function name to report with it to avoid getting errors based on other events being sent before the onset.
Note that this does result in traces being generated in some error cases (e.g. when a function lookup fails), but this is arguably the right approach, those JsRpcSessionCustomEventImpl invocations shouldn't just disappear.

EW-9282 EW-9451 Add missing JSRPC onset regression test
Calling a JSRPC getter method would result in "expected onsetSeen; Tail stream onset was not reported" STW errors.

@fhanau fhanau requested a review from mar-cf August 23, 2025 16:50
@fhanau fhanau requested review from a team as code owners August 23, 2025 16:50
@fhanau fhanau changed the title EW-9371 EW-9282 EW-9451 Add STW JSRpc tests; Add missing JSRPC onset regression test; Fix missing onset event for JSRpc edge cases EW-9371 EW-9282 EW-9451 Add STW JSRpc tests; Fix missing onset event for JSRpc edge cases Aug 23, 2025
@fhanau fhanau force-pushed the felix/082325-missing-onset-fix branch from 177d671 to f55505a Compare August 23, 2025 17:31
@fhanau fhanau force-pushed the felix/082325-missing-onset-fix branch 2 times, most recently from 34462c5 to bfbaadd Compare August 25, 2025 17:04
Copy link
Copy Markdown
Member

@kentonv kentonv left a comment

Choose a reason for hiding this comment

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

As a person who frequently modifies js-rpc-test, I do not want to be on the hook for updating this tracing test every time. Please find a different approach.

If we invoke a customEvent, we should generally report an onset event to the
tracer right away. Under the STW model, we must do so if there's any chance for
events like spans/logs being generated from JS (this wasn't the case with LTW so
far).
For JSRPC, we would only create an onset event after we were able to
successfully get a function or property to call, but we may invoke JS code
before that (e.g. if a JS getter method produced a log). Accordingly, set the
onset as soon as we know the function name to report with it to avoid getting
errors based on other events being sent before the onset.
Note that this does result in traces being generated in some error cases (e.g.
when a function lookup fails), but this is arguably the right approach, those
JsRpcSessionCustomEventImpl invocations shouldn't just disappear.
@fhanau fhanau force-pushed the felix/082325-missing-onset-fix branch from bfbaadd to 74a4403 Compare August 25, 2025 19:08
@fhanau fhanau changed the title EW-9371 EW-9282 EW-9451 Add STW JSRpc tests; Fix missing onset event for JSRpc edge cases EW-9282 EW-9451 Fix missing onset event for JSRpc edge cases, add JSRpc regression test Aug 25, 2025
@fhanau
Copy link
Copy Markdown
Contributor Author

fhanau commented Aug 25, 2025

As a person who frequently modifies js-rpc-test, I do not want to be on the hook for updating this tracing test every time. Please find a different approach.

Updated the PR to only add a simple regression test in a new file. With this change, js-rpc-test.js is no longer coupled to the tail worker test.

Calling a JSRPC getter method would result in "expected onsetSeen; Tail stream
onset was not reported" STW errors.
@fhanau fhanau force-pushed the felix/082325-missing-onset-fix branch from 74a4403 to 2f1622c Compare August 25, 2025 19:12
@fhanau fhanau requested a review from kentonv August 25, 2025 19:12
@kentonv kentonv dismissed their stale review August 25, 2025 20:10

My issue is addressed. (I haven't read the rest of the code.)

@fhanau fhanau merged commit fb3f70d into main Aug 26, 2025
21 checks passed
@fhanau fhanau deleted the felix/082325-missing-onset-fix branch August 26, 2025 15:39
fhanau added a commit that referenced this pull request Aug 29, 2025
…o late

In #4881, we fixed the missing/delayed Onset issue for some cases, but to handle
logs etc. being created in constructors we need to set the event before invoking
JS at all. This requires some slight code duplication so we can access the
method name in time.
fhanau added a commit that referenced this pull request Aug 29, 2025
…o late

In #4881, we fixed the missing/delayed Onset issue for some cases, but to handle
logs etc. being created in constructors we need to set the event before invoking
JS at all. This requires some slight code duplication so we can access the
method name in time.
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.

4 participants