Closed
Description
Problem
Would like parity with the dotnet cohorts who are able to add applicationinsights as a dependency and programatically add instrumentation to an application, example
For java, it seems like the only vended option is to use a javaagent at startup. Would like the ability to do something like this:
public static void main(String[] args) throws IOException {
ApplicationInsights.attach();
SpringApplication.run(SpringBootApp.class, args);
}
Potential Solution
The snippet above is from this codebase, but it's inside test packages
- https://github.com/microsoft/ApplicationInsights-Java/blob/main/test/smoke/testApps/SpringBootAttachInMain/src/main/java/com/microsoft/applicationinsights/smoketestapp/SpringBootApp.java
- https://github.com/microsoft/ApplicationInsights-Java/blob/main/test/smoke/testApps/SpringBootAttachInMain/src/main/java/com/microsoft/applicationinsights/smoketestapp/AttachInFirstLineOfMain.java
I don't mean to link to a competitor.. but this source is apache2-licensed and offers another example