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

WC-2707 Only submit non-empty traces to trace workers #2946

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

Conversation

matthewdavidrodgers
Copy link
Collaborator

Currently, any invocation for a stage generates a trace, even for PipelineLogLevel::NONE. The only difference is that NONE does not attach logs, exceptions, or eventInfo to the trace.

This leads us to see traces with a null event for stages you opted to not get traces from, which we often see when there's a FPW in a pipeline that we did not intend to see.

There are quite a few places throughout this and edgeworker that note that we do this to "keep the request tree contiguous", but from my investigation and chats with other people, these traces are not used for anything other than delivery to trace/tail handlers, i.e. this isn't used to report metrics or billing. So there's no reason to filter these out before delivering traces.

This is of course not as efficient as it could be, as we are allocating for empty traces and then discarding them before submitting. A more comprehensive approach would be to not generate traces at all when the stage / subpipeline's log level is NONE, but that's probably beyond me currently (although I would welcome the help).

I do have a tests that are tweaked to reflect these changes in edgeworker, but there seem to be some quirks / nuances I don't understand there (for example, the tests pass normally but do not pass for process sandboxing) so I was recommended to get a PR up to workerd to begin the discussion here.

Currently, any invocation for a stage generates a trace, even for
PipelineLogLevel::NONE. The only difference is that NONE does not attach
logs, exceptions, or eventInfo to the trace.

This leads us to see traces with a null event for stages you opted to
not get traces from, which we often see when there's a FPW in a pipeline
that we did not intend to see.

There are quite a few places throughout this and edgeworker that note
that we do this to "keep the request tree contiguous", but from my
investigation and chats with other people, these traces are not used for
anything other than delivery to trace/tail handlers, i.e. this isn't
used to report metrics or billing. So there's no reason to filter these
out before delivering traces.

This is of course not as efficient as it could be, as we are allocating
for empty traces and then discarding them before submitting. A more
comprehensive approach would be to not generate traces at all when the
stage / subpipeline's log level is NONE, but that's probably beyond me
currently (although I would welcome the help).

I do have a tests that are tweaked to reflect these changes in
edgeworker, but there seem to be some quirks / nuances I don't
understand there (for example, the tests pass normally but do not pass
for process sandboxing) so I was recommended to get a PR up to workerd
to begin the discussion here.
@matthewdavidrodgers matthewdavidrodgers force-pushed the matthewrodgers/WC-2707-non-empty-traces branch from 110a18c to 6734428 Compare October 17, 2024 22:10
Copy link
Member

@anonrig anonrig left a comment

Choose a reason for hiding this comment

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

Can we have a test for this, so we don't regress?

@matthewdavidrodgers
Copy link
Collaborator Author

@anonrig i have ew-tests written in edgeworker that cover the changes; is there a suitable place to do something similar here?

@anonrig
Copy link
Member

anonrig commented Oct 18, 2024

@anonrig i have ew-tests written in edgeworker that cover the changes; is there a suitable place to do something similar here?

If there is a test in the downstream repo, I don't think we need an additional one here. Thanks!

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