ApplicationInsights-Java icon indicating copy to clipboard operation
ApplicationInsights-Java copied to clipboard

Custom attributes are not populated in Azure Functions' Request spans

Open leninalive opened this issue 1 year ago • 7 comments

Expected behavior

In Application Insights, custom attributes assigned to Request spans (function invocations) are present.

Actual behavior

Only predefined pre-populated attributes are available as custom dimensions (like TriggerReason, FullName, OperationName etc) for function invocation requests.

Sample Application

public class TestFunctionHandler extends FunctionInvoker<Event, String> {

    @FunctionName("testFunction")
    public void execute(
            @QueueTrigger(name = "event", queueName = "queue",
                          connection = "AzureWebJobsStorage")
            Event event,
            ExecutionContext context) {
        Span.current().setAttribute("TestAttribute", event.getData());
        handleRequest(job, context);
    }
}

This code supposed to produce "TestAttribute" in "Custom Dimensions" panel of App Insights' Request, however, only default attributes are actually populated there:

Screenshot 2023-02-15 at 23 25 19

leninalive avatar Feb 15 '23 20:02 leninalive