Azure / Azure/azure-functions-host
ITelemetryProcessor does not appear to be supported in Function Apps
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 36
Description
_From @StevenTaylor on October 5, 2018 5:50_
Documentation (https://docs.microsoft.com/en-us/azure/application-insights/app-insights-api-filtering-sampling) suggests that ITelemetryProcessor can be used to filter\sample the telemetry before it is sent App Insights.
But the implementation code is never called in our Function App.
The code to set up the builder is called, which looks like:
` var builder = TelemetryConfiguration.Active.TelemetryProcessorChainBuilder;
builder.Use((next) => new AppInsightsFilter(next));
builder.Build();`
But the 'Process' method implemented in the class is never called, the class looks like:
` class AppInsightsFilter : ITelemetryProcessor
{
private ITelemetryProcessor Next { get; set; }
// Link processors to each other in a chain.
public AppInsightsFilter(ITelemetryProcessor next)
{
this.Next = next;
}
public void Process(ITelemetry item)
{
// To filter out an item, just return
if (!OKtoSend(item)) { return; }
// Modify the item if required
//ModifyItem(item);
this.Next.Process(item);
}
private bool OKtoSend(ITelemetry item)
{
// try something!
return (DateTime.Now.Second <= 20); // only send for the first 20 seconds of a minute
}
}`
PS. We have tried setting config values SamplingPercentage (App Insights config) and maxTelemetryItemsPerSecond (host.json) as low as possible to reduce the telemetry data, but there is still too much telemetry.
_Copied from original issue: Azure/Azure-Functions#981_
Contributor guide
Research direction
Start by reproducing the Function App telemetry path using TelemetryConfiguration.Active.TelemetryProcessorChainBuilder and the sample AppInsightsFilter implementation described in the issue. Trace whether ITelemetryProcessor.Process is reached, including the host.json and SamplingPercentage settings, and compare the behavior with the linked Application Insights documentation. Done means a Function App can invoke the processor and filter telemetry before it is sent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- cloud, observability-sre
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100