In my expressjs app, each time there is a request, a transaction will be recorded on New Relic. However, as each transaction comes from a different user, I want to add a custom attribute (userId) to the transaction so that I know from which user the request comes from.
The only way to show that custom attribute is from the transaction trace > transaction details.
However, it appears that ONLY long transactions have a trace. So, I can't track the userId for each transaction.
What's wrong am I doing? Is it a good practice to add custom attribute to each transaction?
Here is the important lines in my node.js code:
// beginning of the file
const newrelic = require('newrelic');
...
app.get('/blah', function(req, res, next) {
newrelic.addCustomAttribute('test', 28);
...
});