You can access agent API after initializing the agent:
var apm = require('elastic-apm-js-base').init(...)
Call this method to enrich collected performance data and errors with information about the user.
context argument must be an object and can contain the following properties (all optional):
id- The users ID
username- The users username
The provided user context is stored under
context.user in Elasticsearch on both errors and transactions.
Call this to enrich collected errors and transactions with any information that you think will help you debug performance issues or errors.
The provided custom context is stored under
context.custom in Elasticsearch on both errors and transactions.
context argument must be an object and can contain any property that can be JSON encoded.