「hello world」タイプの Java アプリケーションを使用してアプリケーション インサイトにデータを送信していますが、これまでのところ何も表示されません。私はこれまでのところ指示に従いました。Azure ポータルでアプリ インサイト リソースを作成し、アプリケーションでそのインストルメンテーション キーを使用して、applicationinsight.xml、web.xml、および pom.xml を正しく構成したままにしました。しかし、データを送信することはできません。以下は私のポンです...
<?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>
これは私の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>
これは私のサンプルコードです
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();
}
以下は、アプリケーションを実行するたびに取得するログです。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: コードで telemetryClient.flush() の前に Thread.sleep(7000) を追加したところ、ソケット例外はなくなりましたが、アプリケーション インサイト リソースにはまだデータがありません
****Update2: アプリの洞察データを送信するためのサンプル C# コンソール アプリケーションを作成しましたが、そこにも運がありませんでした。Fiddler を使用してトラフィックを監視しています。興味深いアウトバウンド HTTP リクエストを見つけたら更新します
****Update3: フィドラーと Java で少し遊んだ後 (Javaでフィドラーで https をキャプチャする方法)、 https://dc.services.visualstudio.com/v2/trackへのアウトバウンド トラフィックをキャプチャできました。しかし、Azure ポータルの Application Insights リソースにはまだ何も表示されませんでした