I setup some dependency tracking for a Azure Function App implemented with Java. Therefore I added applicationinsights-core
as dependency, see Add the Application Insights SDK for Java to your project.
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-core</artifactId>
<version>2.6.2</version>
</dependency>
To create a dependencies
entry, I use an instance of TelemetryClient
.
// call an external service, e.g. ADLS file upload..
long start = System.currentTimeMillis();
uploadFile();
long elapsed = System.currentTimeMillis() - start;
// void trackDependency(String dependencyName, String commandName, Duration duration, boolean success)
new TelemetryClient().trackDependency(
"ADLS", "upload file", new Duration(elapsed), true);
The resulting dependencies
entry looks strange. It misses the cloud_RoleName
, which usually identifies the creator of the entry. In addition, the commandName
is passed as data
property and there seems no way to set the type
property of the entry.
While I found no dedicated Java Function App documentation for dependency tracking, the general Java documentation recommends to use the applicationinsights-agent
additionally (see Java codeless application monitoring Azure Monitor Application Insights). The agent handles the telemetry of applicationinsights-core
(see Supported custom telemetry). But it isn't obvious to me, how to setup the agent for Azure Function App.
How can I setup the cloud_RoleName
?
Is there a way to set dependencies
's type
property?