Tracing WS (Websocket) consumers can be done in two methods:

  1. Auto-tracing using the environment variable.
  2. Calling the SDK.
    Calling the SDK is simple, and should be done in your main js file where the consumer is being initialized:
const epsagon = require('epsagon-frameworks');
  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())

Did this page help you?