I'm using a "hello world" type java application to send some data to application insight, but not able to see any thing so far. I have followed the instructions so far. Created app insight resource in azure portal, used that instrumentaion key in my application, kept the applicationinsight.xml, web.xml and pom.xml configured correctly. But never able to send any data. Following is my pom...
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>test1</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-web</artifactId>
<!-- or applicationinsights-core for bare API -->
<version>[1.0,)</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-core</artifactId>
<!-- or applicationinsights-core for bare API -->
<version>[1.0,)</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>central</id>
<name>Central</name>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Using env.test.properties</echo>
<copy file="${basedir}/src/ApplicationInsights.xml" tofile="${basedir}/target/classes/ApplicationInsights.xml"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
This is my applicationinsight.xml ...
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings" schemaVersion="2014-05-30">
<InstrumentationKey>my_key</InstrumentationKey>
<ContextInitializers>
</ContextInitializers>
<TelemetryInitializers>
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebOperationIdTelemetryInitializer"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebOperationNameTelemetryInitializer"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebSessionTelemetryInitializer"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebUserTelemetryInitializer"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebUserAgentTelemetryInitializer"/>
</TelemetryInitializers>
<TelemetryModules>
<Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebRequestTrackingTelemetryModule"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebSessionTrackingTelemetryModule"/>
<Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebUserTrackingTelemetryModule"/>
</TelemetryModules>
<Channel>
<!--
Setting DeveloperMode to true will enable immediate transmission of the telemetry events, which can be helpful during the development process.
Make sure to turn this off on production servers due to performance considerations.
-->
<DeveloperMode>true</DeveloperMode>
</Channel>
<DisableTelemetry>false</DisableTelemetry>
<SDKLogger />
</ApplicationInsights>
this is my sample code
TelemetryClient tc = new TelemetryClient();
tc.getContext().setInstrumentationKey("my_key");
Map<String, String> properties = new HashMap<String, String>();
properties.put("Game", "GameName");
properties.put("Difficulty", "hard");
Map<String, Double> measurements = new HashMap<String, Double>();
measurements.put("GameScore", 20.0);
measurements.put("Opponents", 1.0);
try{
tc.trackEvent("WinGame", properties, measurements);
tc.flush();
} catch (Exception e)
{
e.printStackTrace();
}
Following is the log I get every time I run my application, Am I missing some configuration step?
AI: INFO 29-10-2016 13:18, 1: Configuration file has been successfully found as resource
AI: INFO 29-10-2016 13:18, 1: 'MaxTelemetryBufferCapacity': null value is replaced with '500'
AI: INFO 29-10-2016 13:18, 1: 'FlushIntervalInSeconds': null value is replaced with '5'
AI: TRACE 29-10-2016 13:18, 1: Using Http Client version 4.3+
AI: INFO 29-10-2016 13:18, 1: 'Channel.MaxTransmissionStorageCapacityInMB': null value is replaced with '10'
AI: ERROR 29-10-2016 13:18, 1: Failed to create empty class name
AI: TRACE 29-10-2016 13:18, 1: C:\Users\myuser\AppData\Local\Temp\AISDK\native\1.0.6 folder exists
AI: TRACE 29-10-2016 13:18, 1: Java process name is set to 'java#1'
AI: TRACE 29-10-2016 13:18, 1: Successfully loaded library 'applicationinsights-core-native-win64.dll'
AI: ERROR 29-10-2016 13:18, 1: Failed to create DeadLockDetector, exception: null
AI: ERROR 29-10-2016 13:18, 1: Failed to create JvmHeapMemoryUsedPerformanceCounter, exception: null
AI: TRACE 29-10-2016 13:18, 1: Registering PC 'JSDK_ProcessMemoryPerformanceCounter'
AI: TRACE 29-10-2016 13:18, 1: Registering PC 'JSDK_ProcessCpuPerformanceCounter'
AI: TRACE 29-10-2016 13:18, 1: Registering PC 'JSDK_WindowsPerformanceCounterAsPC'
AI: TRACE 29-10-2016 13:18, 1: InProcessTelemetryChannel sending telemetry
AI: ERROR 29-10-2016 13:18, 20: Failed to send, unexpected exception: Connection pool shut down
****Update1: I added Thread.sleep(7000) before telemetryClient.flush() in the code and the socket exception is gone, but still no data in application-insight resource
****Update2: wrote a sample C# console application to send app insight data, and no luck there as well. I am using Fiddler to monitor traffics. Will update if I see some interesting outbound HTTP requests
****Update3: after playing a little bit with fiddler and java (how to Capture https with fiddler, in java) I was able to capture outbound traffics towards https://dc.services.visualstudio.com/v2/track, but nothing showed up yet in application insight resource in the azure portal