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
This commit is contained in:
Eric Eastwood 2023-05-02 00:55:22 -05:00 committed by GitHub
parent 9078abf4f1
commit 858c9dde8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 6 deletions

View File

@ -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;
},
},