Skip to content
Advertisement

Track outgoing REST call in Java Function App inside Application Insights

From what I understand Azure Application Insights is able to automatically track and log incoming HTTP requests to an application.

However, my usecase is I need to track an outgoing HTTP request (that I make programmatically).

I have a Java Function App (with an HTTP trigger) running in Azure with App Insights attached to it. It logs logs the incoming HTTP request to the function app. Once triggered, my app makes a REST call to a 3rd party REST API. I would like to log this call either as a request or as a dependency under the function app in App Insights

Pointers on how to do this are appreciated.

The documentation seems vague. I looked at a similar question that is answered for C# as well as this, but my question is JAVA and Function App specific and I want the request to be logged and correlated correctly to the above Function APP

Advertisement

Answer

After some back and forth with Microsoft about this, it turns out Azure functions has a specific set of configuration parameters that needs to be put in. I am posting the windows one as thats what I used, but the linux one is in the link as well.

(Windows): XDT_MicrosoftApplicationInsights_Java -> 1

ApplicationInsightsAgent_EXTENSION_VERSION -> ~2

https://learn.microsoft.com/en-us/azure/azure-monitor/app/monitor-functions#how-to-enable-distributed-tracing-for-java-function-apps

Advertisement