From 858c9dde8b22e8a0224c2ab876efb9a966e8d20f Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 2 May 2023 00:55:22 -0500 Subject: [PATCH] We can better detect static assets to avoid tracing nowadays (#207) Because all assets are served from `/assets` since https://github.com/matrix-org/matrix-public-archive/pull/175 --- server/tracing/tracing.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/server/tracing/tracing.js b/server/tracing/tracing.js index ac1f839..777e4ef 100644 --- a/server/tracing/tracing.js +++ b/server/tracing/tracing.js @@ -83,12 +83,9 @@ function startTracing() { // `@opentelemetry/instrumentation-express` but that's not the case, see // https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1034#issuecomment-1158435392 ignoreIncomingRequestHook: (req) => { - // Ignore spans from static assets. - // - // FIXME: Ideally, all of the assets would all be served under - // `/static/` so we could ignore that way instead. In Hydrogen, this - // is tracked by https://github.com/vector-im/hydrogen-web/issues/757 - const isStaticAsset = !!req.url.match(/\.(css|js|svg|woff2)(\?.*?)?$/); + // Ignore spans from static assets. It's just noise to trace them and there + // is nothing special about the routes. + const isStaticAsset = !!req.url.match(/^\/assets\//); return isStaticAsset; }, },