I am registering a Custom telemetry processor in an azure function - during startup, however, the customer processor is never fired. My code looks like this:
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
// ...
builder.Services.AddHttpContextAccessor();
builder.Services.AddApplicationInsightsTelemetryProcessor<CustomTelemetryProcessor>();
// ...
}
}
public class CustomTelemetryProcessor : ITelemetryProcessor
{
private ITelemetryProcessor _next;
private IHttpContextAccessor _httpContextAccessor;
public CustomTelemetryProcessor(ITelemetryProcessor next, IHttpContextAccessor httpContextAccessor)
{
// never gets to here
_next = next;
_httpContextAccessor = httpContextAccessor;
}
public void Process(ITelemetry item)
{
// never gets here
if (item is OperationTelemetry operationTelemetry)
{
// ...
operationTelemetry.Properties.Add("MyCustomProperty", "MyCustomValue");
// ...
}
// Send the item to the next TelemetryProcessor
_next.Process(item);
}
}
This approach works fine in a Web API. Is there a workaround? Or am I missing something?
