sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

Middleware tracing

Open nicohrubec opened this issue 1 month ago • 1 comments

These go through the server entry point. So I think we can just start a span in our provided wrapper and attach any relevant meta data.

Tests: Add tests that verify that middleware emits spans.

nicohrubec avatar Nov 21 '25 15:11 nicohrubec

JS-1194

linear[bot] avatar Nov 21 '25 15:11 linear[bot]

From initial testing it seems that adding a middleware doesn't change the information we have available in the server entry point, i.e. our existing wrapper for the server entry point won't be enough to instrument this. Instead, we will need some other type of mechanism to instrument this. There is many ways to set middleware in tss applications. For instance, there is three types of tss middleware and each needs to be enabled in a different place in tss applications. Therefore, I think adding additional API for manual wrapping of these places would be lots of friction and people would probably just not do it. Alternatively, I think the way to go here is to go with automatic instrumentation via a custom otel integration that hooks into relevant tss API. Concretely, this should be:

nicohrubec avatar Dec 16 '25 13:12 nicohrubec