Adding APM elastic agent to strapi

Instead of npm run start you can also create a server.js

const strapi = require('@strapi/strapi');

strapi(/* {...} */).start();

you can extend this similar to this


// Add this to the VERY top of the first file loaded in your app
const apm = require('elastic-apm-node').start({
  // Override service name from package.json
  // Allowed characters: a-z, A-Z, 0-9, -, _, and space
  serviceName: '',

  // Use if APM Server requires a token
  secretToken: '',

  // Use if APM Server uses API keys for authentication
  apiKey: '',

  // Set custom APM Server URL (default: http://localhost:8200)
  serverUrl: '',
})

const strapi = require('@strapi/strapi');

strapi(/* {...} */).start();

Link: Deployment - Strapi Developer Docs