Azure / Azure/azure-functions-host
How to stop sending telemetry from a specific function in Azure Functions
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 36
Description
#### What problem would the feature you're requesting solve? Please describe.
I created a function app in azure portal and configured Application Insights. Inside the function app, I have created 3 function instances(blobTrigger , httpTrigger, queueTrigger). And now I want to stop sending telemetry from httpTrigger function instance to Application Insights. How can I do that?
#### Describe the solution you'd like
As per this [doc](https://docs.microsoft.com/en-us/azure/azure-functions/functions-host-json#logging), I can specify the logLevel to None for this httpTrigger function instance in host.json. The sample host.json as below:
```
{
"version": "2.0",
"extensions": {
"http": {
"routePrefix": ""
}
},
"logging": {
"logLevel": {
"Function.httpTrigger": "None",
"default": "Trace"
}
}
}
```
But this solution can work partially, it did stop the telemetry inside the httpTrigger function instance(like if I write this line of code `log.LogInformation("a test message")` inside httpTrigger function instance, then the message from `log.LogInformation()` cannot send to application insights.). However, there are some other information about httpTrigger still send to application insights, like "httpTrigger: Request URL host xxxx, response code: 200 xxxx" / "request successfully matched the route with name httpTrigger xxx". The screenshot as below:

#### Describe alternatives you've considered
NA
#### Additional context
NA
Contributor guide
Research direction
Start with the host.json logging configuration, especially the Function.httpTrigger logLevel setting, and trace which Application Insights entries remain for that function. Compare user log messages with the host-generated request and route-matching telemetry shown in the issue. Done means telemetry from httpTrigger can be excluded without suppressing telemetry from the other functions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- cloud, observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100