CD-jS CD-jS - 2 months ago 23
Node.js Question

Tagging metrics in Application Insights for NodeJS

I am currently adding Application Insights into my NodeJS application, I have the package installed and successfully transmitting data, however I would like to add additional tags to each data point as it is sent.

Looking at the docs, it seems a Telemetry Processor is the place to do this, but using the code below I cannot see the tags in the Azure Portal.

var TraceProcessor = function (envelope) {
envelope.tags['TestTag'] = 'Test Tag';
return true;
module.exports = TraceProcessor;

I can see the code being executed and the tag being added, but cannot see this tag to filter by it in the Azure Portal.

Am I adding the tags correctly and if so where can I filter the data by these in the portal?


So I figured this out and it eventually turned out to be a combination of both my original approach and the one suggested by John.

var TraceProcessor = function (envelope) {['TraceID'] = 'trace1';
    return true;
module.exports = TraceProcessor;

Custom properties were indeed what I needed, but the telemetry processor I already had was what was needed to be able to do this with the automatic telemetry for every request.