ApplicationInsights-Java
ApplicationInsights-Java copied to clipboard
Custom attributes are not populated in Azure Functions' Request spans
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](https://user-images.githubusercontent.com/16370118/219146817-94921046-7d0c-479f-ab53-38bd1def351a.png)