Azure / Azure/azure-functions-dotnet-worker

Make Application Insights ServerTelemetryChannel flush interval (MaxTelemetryBufferDelay) configurable in the worker

Open
#3,465 0 comments 0 reactions 0 assignees View on GitHub
Needs: Triage (Functions)
Dominant language
C#
Stars
466
Forks
215
Avg merge
3d 10h
Merged PRs (30d)
7

Description

### Summary

The Application Insights `ServerTelemetryChannel` (registered by `AddApplicationInsightsTelemetryWorkerService()`) buffers telemetry in memory and flushes it to the ingestion endpoint based on `MaxTelemetryBufferDelay` (default **30 seconds** in the App Insights SDK, or sooner once the buffer fills). The `Microsoft.Azure.Functions.Worker.ApplicationInsights` integration does not expose this, so customers cannot tune how quickly telemetry becomes visible without reaching into the channel themselves.

### Request

Expose the channel flush interval as a configurable option on the Functions worker Application Insights integration, and apply it to the `ServerTelemetryChannel`.

### Proposed behavior

- New public `FunctionsApplicationInsightsOptions.MaxTelemetryBufferDelay` (`TimeSpan`), default **8 seconds**, minimum **5 seconds**.
- Configurable via a new `ConfigureFunctionsApplicationInsights(Action)` overload:

```csharp
services
.AddApplicationInsightsTelemetryWorkerService()
.ConfigureFunctionsApplicationInsights(o => o.MaxTelemetryBufferDelay = TimeSpan.FromSeconds(8));
```

- Only applied when the configured telemetry channel is a `ServerTelemetryChannel`. Values below the 5s minimum throw `ArgumentOutOfRangeException`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the AddApplicationInsightsTelemetryWorkerService registration and the ConfigureFunctionsApplicationInsights entry point, then trace how the ServerTelemetryChannel is configured. Add the public option and validation described in the issue, apply it only to that channel, and verify the default, minimum-boundary, invalid-value, and custom-value behaviors with the integration's existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
observability
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.