Repository navigation
Conversation
2 of 5 tasks
jasnell
reviewed
Oct 11, 2026
|
|
||
| // Where an OtlpSpanSubmitter's spans go, and which spans it takes. Refcounted because the | ||
| // submitters of one invocation share it and may outlive the tracer. | ||
| class OtlpSpanExporter: public kj::Refcounted { |
Collaborator
There was a problem hiding this comment.
nit: unless OtlpSpanExporter needs to hand off refs to itself, it really doesn't need to extend public kj::Refcounted any more right?
jasnell
reviewed
Oct 11, 2026
| @@ -7907,6 +7919,12 @@ kj::Promise<void> Server::startServices(jsg::V8System& v8System, | |||
| } | |||
| } | |||
|
|
|||
| if (config.getTracing().hasOtlp()) { | |||
| otlpExporter = kj::refcounted<OtlpExporter>( | |||
Collaborator
There was a problem hiding this comment.
kj::rc and kj::Rc instead?
jasnell
reviewed
Oct 11, 2026
|
|
||
| class OtlpExporter; | ||
| // Set when the config's `tracing.otlp` names a collector. | ||
| kj::Maybe<kj::Own<OtlpExporter>> otlpExporter; |
jasnell
approved these changes
Oct 11, 2026
|
All contributors have signed the CLA ✍️ ✅ |
Collaborator
|
I have read the CLA Document and I hereby sign the CLA |
wperron
force-pushed
the
dlapid/user-tracing-otlp
branch
from
October 26, 2026 19:13
82bb3ec to
9faabe2
Compare
|
The generated output of |
Workers user spans reach a tracing backend today only through Streaming Tail Workers: the Workers Observability tail worker rebuilds them in JavaScript from tail events. Spans built that way are cut off when a Durable Object hands off work, carry coarse I/O-clock timestamps, and are sampled only after they already exist. This gives the runtime what it needs to export user spans itself, as OTLP, the way other Cloudflare services already do: - an OTLP encoder for spans, written in Rust, behind the existing span submitter interface; - a tracer hook that lets the embedder open each invocation's root span, so the invocation and all of its user spans form one exported trace; - precise timestamps for user spans, which no longer reach user code directly. workerd can also export on its own: a new `tracing.otlp` setting sends each invocation's spans to an OTLP/HTTP collector such as a local Jaeger. That makes Workers traces visible in local development without a tail worker. Nothing changes unless an embedder installs the hook or the setting is configured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The filter is a stopgap copied from the Workers Observability tail worker. Record why it is unsatisfying and that it can be removed once every binding talks to its backend over JSRPC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Some bindings (D1, AI, Images, Vectorize) reach their backend with an internal fetch to a placeholder host. Those fetch spans were dropped when they ended, but by then their id had already been handed to the backend as its parent, so any spans the backend exported were orphaned at the top of the trace. Decide when the fetch starts instead: a fetch to one of these hosts opens no user span, and the binding's own span (such as d1_run) becomes the subrequest's parent. Matching by host is still a stopgap until every binding talks to its backend over JSRPC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An uncaught exception reported for the invocation went only to the streaming tail, so the exported root span had the exception outcome but no exception event and no status message. Record it on the root, as tail-built traces did. An exception reported while one of the worker's own spans is active belongs to that span and is left off the root. When an exception supplies the status message, still derive error.type, so every ERROR span carries one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The OpenTelemetry spec doesn't care about the order of start times, neither does the waterfall view in the dashboard.
The http_request spans demonstrated creating spans outside the Worker request lifecycle, but are unnecessary for this PR.
- Add the `InstrumentationScope` to the proto - Set the name to `workers-runtime` to match the telemetry sdk name
- [setting UNSET should be ignore][1] - [setting OK is final][2] [1]: https://opentelemetry.io/docs/specs/otel/trace/api/#set-status:~:text=An%20attempt%20to%20set%20value%20Unset%20SHOULD%20be%20ignored. [2]: https://opentelemetry.io/docs/specs/otel/trace/api/#set-status:~:text=When%20span%20status%20is%20set%20to%20Ok%20it%20SHOULD%20be%20considered%20final%20and%20any%20further%20attempts%20to%20change%20it%20SHOULD%20be%20ignored.
Keep shared exporter ownership in Rc handles rather than requiring\nintrusive Refcounted inheritance. Preserve the unique server control\nhandle and collector unlinking during shutdown.
Regenerate the crate_universe graph for prost against the current main dependency graph. Verify with repinning disabled and the focused OTLP and tracing tests.
wperron
force-pushed
the
dlapid/user-tracing-otlp
branch
from
October 28, 2026 15:21
122e1d1 to
f727d85
Compare
jasnell
approved these changes
Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Workers user spans reach a tracing backend today only through Streaming Tail Workers: the Workers Observability tail worker rebuilds them in JavaScript from tail events. Spans built that way are cut off when a Durable Object hands off work, carry coarse I/O-clock timestamps, and are sampled only after they already exist.
This gives the runtime what it needs to export user spans itself, as OTLP, the way other Cloudflare services already do:
workerd can also export on its own: a new
tracing.otlpsetting sends each invocation's spans to an OTLP/HTTP collector such as a local Jaeger. That makes Workers traces visible in local development without a tail worker.Nothing changes unless an embedder installs the hook or the setting is configured.