Skip to content

Conversation

@fhanau
Copy link
Contributor

@fhanau fhanau commented Nov 13, 2025

  • Introduce a new WorkerTracer parameter indicating whether any BTWs are
    present. In a follow-up, this will be used to optimize memory management,
    but for now it helps us assert that if we have a tracer with logLevel none,
    we have BTWs (otherwise the tracer would be redundant, indicating waste).
  • Log an error if a WorkerTracer is destructed without getting the Outcome event
    even when logLevel == none

@fhanau fhanau force-pushed the felix/110925-stw-2 branch from d8a2a9c to 3d6898e Compare November 20, 2025 03:21
@fhanau fhanau changed the title [DRAFT][o11y] Additional hardening against missing outcome event, STW optimizations [o11y] Additional hardening against missing outcome event, STW optimizations Nov 20, 2025
@fhanau fhanau marked this pull request as ready for review November 20, 2025 03:22
@fhanau fhanau requested review from a team as code owners November 20, 2025 03:22
return buffered;
}

protected:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The protected thing here won't be needed once #5519 and the corresponding internal PR have landed.

auto& tailStreamWriter = KJ_UNWRAP_OR_RETURN(maybeTailStreamWriter);
// This is where we'll actually encode the span. This function should never be invoked if STW is
// inactive as span tracing is only used in STW.
auto& tailStreamWriter = KJ_ASSERT_NONNULL(maybeTailStreamWriter);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is intended as additional hardening, using KJ_UNWRAP_OR_RETURN could cause us to miss out on span tracing being set up when it is not being used – I'm highly confident that we're already avoiding this though.


KJ_IF_SOME(writer, maybeTailStreamWriter) {
auto& spanContext = KJ_UNWRAP_OR_RETURN(topLevelInvocationSpanContext);
auto& spanContext = KJ_ASSERT_NONNULL(topLevelInvocationSpanContext);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This serves as additional hardening too, I'm very confident that we always provide the Onset event when doing tracing.

@fhanau
Copy link
Contributor Author

fhanau commented Nov 20, 2025

Downstream PR is still WIP, but this is ready for review.

@fhanau fhanau requested a review from mar-cf November 20, 2025 03:26
@fhanau fhanau force-pushed the felix/110925-stw-2 branch from 3d6898e to 5dc1403 Compare November 24, 2025 02:06
@github-actions
Copy link

github-actions bot commented Nov 24, 2025

The generated output of @cloudflare/workers-types matches the snapshot in types/generated-snapshot 🎉

…zations

- Introduce a new WorkerTracer parameter indicating whether any BTWs are
  present. In a follow-up, this will be used to optimize memory management,
  but for now it helps us assert that if we have a tracer with logLevel none,
  we have BTWs (otherwise the tracer would be redundant, indicating waste).
- Log an error if a WorkerTracer is destructed without getting the Outcome event
  even when logLevel == none
@fhanau fhanau force-pushed the felix/110925-stw-2 branch from 5dc1403 to b329282 Compare November 24, 2025 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant