UNPKG

@europeana/portal

Version:
19 lines (14 loc) 474 B
import apm from 'elastic-apm-node'; import { parseRoute } from './utils'; // Server-side plugin to set the transaction name based on the Vue route. export default ({ route, req, app }, inject) => { if (!apm.isStarted()) { return; } const parsed = parseRoute(route, { localeCodes: app.i18n?.localeCodes }); apm.setTransactionName(`${req.method} ${parsed.path}`); if (parsed.locale) { apm.setLabel('locale', parsed.locale); } inject('apm', apm); };