Skip to content

Commit

Permalink
misc: filter out short SPUBLISH APM spans
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinKolarik committed Jan 15, 2025
1 parent 5305232 commit c2b84d2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lib/http/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ apmAgent.addTransactionFilter(apmUtils.transactionFilter({
keepResponse: [ 'location' ],
}));

// Filter out short SPUBLISH spans.
apmAgent.addSpanFilter((payload) => {
if (payload['type'] !== 'db' || payload['subtype'] !== 'redis' || [ 'SPUBLISH' ].includes(payload['name'] as string)) {
return payload;
}

if (payload['duration'] > 10) {
return payload;
}

return false;
});

const app = new Koa({ proxy: true });
const publicPath = url.fileURLToPath(new URL('.', import.meta.url)) + '/../../../public';
const docsHost = config.get<string>('server.docsHost');
Expand Down

0 comments on commit c2b84d2

Please sign in to comment.