Tracing WS (Websocket)
consumers can be done in two methods:
- Auto-tracing using the environment variable.
- Calling the SDK.
Calling the SDK is simple, and should be done in your mainjs
file where the consumer is being initialized:
const epsagon = require('epsagon-frameworks');
epsagon.init({
token: 'epsagon-token',
appName: 'app-name-stage',
metadataOnly: false,
});
Tagging traces, setting custom errors/warnings or get current trace url can be by:
socket.on('message', (message, epsagonSdk) => {
epsagonSdk.label('key', 'value');
epsagonSdk.setError(Error('My custom error'));
epsagonSdk.setWarning(Error('My custom warning'));
console.log('Epsagon trace URL:', epsagonSdk.getTraceUrl())
})
Updated 2 months ago