egiray
egiray

Reputation: 1209

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

I've read the azure documents (https://learn.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)

Upvotes: 1

Views: 1879

Answers (1)

Ivan Glasenberg
Ivan Glasenberg

Reputation: 30035

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();

Upvotes: 2

Related Questions