-
Download Sling Starter Standalone from https://sling.apache.org/downloads.cgi
-
Download applicationinsights-agent-{version}.jar from https://github.com/microsoft/ApplicationInsights-Java/releases
-
Create file
AI-Agent.xml
with the following content:<?xml version="1.0" encoding="utf-8"?> <ApplicationInsightsAgent> <Instrumentation> <BuiltIn enabled="true"> </BuiltIn> </Instrumentation> </ApplicationInsightsAgent>
-
Put all three files in the same directory
- org.apache.sling.starter-11.jar
- applicationinsights-agent-{version}.jar
- AI-Agent.xml
-
Run sling
java -javaagent:applicationinsights-agent-{version}.jar -jar org.apache.sling.starter-11.jar
-
Update the instrumentation key in
src/main/resources/ApplicationInsights.xml
-
Optionally enable debug logging in the
ApplicationInsights.xml
file by uncommenting<SDKLogger type="CONSOLE"> <Level>TRACE</Level> </SDKLogger>
and
<Channel> <DeveloperMode>true</DeveloperMode> </Channel>
-
Build with maven
mvn clean package
-
Go to
http://localhost:8080/system/console/bundles
-
Log in with
admin
/admin
-
Click
Install/Update...
-
Select the bundle from
target/apache-sling-sample-1.0-SNAPSHOT.jar
-
Check
Start Bundle
-
Click
Install or Update
-
Go to
http://localhost:8080/hello-world-servlet
-
Request and dependency telemetry should show up in Azure Portal within a couple of minutes
-
If you turned on debug logging above, you should see the captured request and dependency telemetry json in the console window right away (where you ran
java -javaagent:... -jar ...
)