@rlanz/sentry
Version:
A wrapper around the Sentry SDK to make it easier to use in a AdonisJS application
20 lines (19 loc) • 543 B
JavaScript
/*
* @rlanz/sentry
*
* (c) Romain Lanz
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import { Sentry } from './sentry.js';
export default class SentryMiddleware {
async handle(ctx, next) {
const activeSpan = Sentry.getActiveSpan();
const rootSpan = activeSpan && Sentry.getRootSpan(activeSpan);
if (rootSpan) {
Sentry.updateSpanName(rootSpan, ctx.routeKey || 'unknown');
}
return next();
}
}