I have an Azure Function App written in Node.js 14. I need to set the "EnableAdaptiveSampling" to false but I don't know where I can find this parameter.
After having read many other StackOverflow questions, it seems that I can disable this parameter either in the "appsettings.json" file or in the ConfigureServices method (.cs) or the "ApplicationInsights.config" file.
Here there are some other StackOverflow similar questions in which is often specified a file called "startup.cs", but it is not clear where this file is located and for what it is used:
I don't know if this information can be useful but my Azure infrastructure, and therefore also Application Insights, is deployed via Terraform.
Now, in the folder of my project, where I have located the Terraform files and the function app scripts, I don't see any "appsettings.json", "ApplicationInsights.config" file or general".cs" file, there is only a file called "host.json" inside the Function App folder that looks like this:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
}
In which I see something related to sampling of my function app, but I don't see the adaptive sampling option.
In the following, a list of my questions:
samplingSettings
to false from the host.json file, do I disable adaptive sampling as well?Here a list of some Azure documentation that I read:
How to configure monitoring for Azure Functions
Sampling in Application Insights
But after reading this documentation it is still not clear where I can find this files and how to disable adaptive sampling.
For the first 3 questions can be found only when an azure function app is deployed using .net as runtime stack as .cs is an c# extension.
To find appsettings.json file it can be found in configurations and go to appsettings and click advancededit so we can find appsettings.json as you can see below.
And appsetting.json look like this.
And for ApplicationInsights.config file we cant directly find the file but in applications insights of function app configurations can be done like telemetry,alerts etc.
Now for the last one about disabling the sampling in azure function app "YES" it can be done by disabling adaptive sampling in settings and there is an other way by setting "isEnable" to False in host.json as below code.
Json File:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": false
}
}
}
}