1
votes

I've read the azure documents (https://docs.microsoft.com/en-us/azure/azure-monitor/app/sampling). There are examples with .Net and Java and also Javascript for client. But could not see a example for node.js (backend).

How can I disable sampling in Azure Application Insights with Node.js (backend)

1
Is this you are looking for?Ivan Yang

1 Answers

2
votes

As per this doc:

By default, the SDK will send all collected data to the Application Insights service.

So the sampling is disabled by default.

And you can also use the following code to disable/enable sampling by setting samplingPercentage to 0 or non-zero value, like below:

const appInsights = require("applicationinsights");
appInsights.setup("<instrumentation_key>");
appInsights.defaultClient.config.samplingPercentage = 33; // 33% of all telemetry will be sent to Application Insights
appInsights.start();