Tracing @google-cloud/pubsub
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 main js
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 or setting custom errors can be by:
await consumer.run({
eachMessage: async ({ topic, partition, message }) => {
message.epsagon.label('key', 'value');
message.epsagon.setError(Error('My custom error'));
},
})
Updated 8 months ago