feat(server-utils): Implement orchestrion-based express integration#21889
feat(server-utils): Implement orchestrion-based express integration#21889mydea wants to merge 7 commits into
Conversation
|
|
||
| // Honor `ignoreLayers`/`ignoreLayersType`: skip the span for matching layers. | ||
| if (isLayerIgnored(name, type, options)) { | ||
| return undefined; |
There was a problem hiding this comment.
Transaction name before ignore check
Medium Severity
For ignored request-handler layers, the orchestrion path still calls setTransactionName before isLayerIgnored returns. The OTel patchLayer path sets the transaction name only after the ignore check, so ignoreLayers / ignoreLayersType can leave a transaction renamed without the matching span.
Reviewed by Cursor Bugbot for commit b086dd5. Configure here.
There was a problem hiding this comment.
this is more correct now IMHO
| mysqlChannelIntegration(), | ||
| lruMemoizerChannelIntegration(), | ||
| expressChannelIntegration(), | ||
| ] as const; |
There was a problem hiding this comment.
Express options not wired
Medium Severity
Orchestrion mode registers expressChannelIntegration() with no options while replacing the default OTel Express integration. User ignoreLayers and ignoreLayersType settings on expressIntegration never reach the channel integration, so layer filtering lacks parity with the OTel path.
Reviewed by Cursor Bugbot for commit b086dd5. Configure here.
There was a problem hiding this comment.
this is normal, if you pass in the express channel intergation manually it will overwrite
b086dd5 to
9b43cbb
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9b43cbb. Configure here.


Closes #20917
This adds a new
expressChannelIntegrationbased on orchestrion. It should keep feature parity — we have a lot of Express tests, and the core tracing tests now run against this integration (via theorchestrionvariant), which gives good coverage for now.A follow up would be to also handle the error handler automatically where possible.
Route resolution: metadata is only set for genuinely matched routes
The OpenTelemetry Express integration patches every layer's
handle, reconstructs the route from the layers that ran (getConstructedRoute), and validates it against the request URL (getActualMatchedRoute) to discard paths that didn't truly match.This integration instead hooks Express's per-layer
Layer.prototype.handle_request(v4) /handleRequest(v5, therouterpackage). Express only calls that method for a layer whose path and method matched, so arequest_handlerspan only ever exists for a route that genuinely matched. Route metadata —http.route, the roothttp.serverspan's route attribute, and the transaction name — is therefore taken directly from the matched route, with no separate reconstruct/validate step.The observable consequence, which is intentional:
request_handlerspan is created and no route (or route-based transaction name) is set.middleware-type spans, which never set route attributes.This is a different mechanism from the OTel path, but it lands on the same net result:
getActualMatchedRoutereturnsundefinedin exactly these cases, so the OTel integration also emits no route there. We get it structurally, from the injection point, rather than by validating after the fact.