2016-10-29 7 views
0

응용 프로그램 통찰력에 일부 데이터를 보내려면 "hello world"유형의 Java 응용 프로그램을 사용하지만 가능하지는 않습니다 지금까지 어떤 것을 볼 수 있습니다. 나는 지금까지 지시 사항을 따라 갔다. Azure 포털에서 애플리케이션 통찰력 리소스를 생성하고 응용 프로그램에서 해당 instrumenta 키를 사용하면 은 applicationinsight.xml, web.xml 및 pom.xml이 올바르게 구성되어 있습니다. 그러나 어떤 데이터도 보낼 수 없었습니다. 이 다음 내 샘플 코드내 샘플 Java 응용 프로그램에 대한 응용 프로그램 통찰력 데이터를 볼 수 없습니다. 예기치 않은 예외가 발생했습니다. 연결 풀 종료

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(); 
} 

입니다

<?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> 

이 내 applicationinsight.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> 

내 치어는 ... ... 나는 모든 시간을 얻을 로그입니다 다음 내 응용 프로그램을 실행, 일부 구성 단계가 누락 되었습니까?

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 

**** 갱신 1 : 나는 코드에서 telemetryClient.flush() 전에 (7000)에 Thread.sleep 추가 소켓 예외는 여전히 응용 프로그램 통찰력 자원에 데이터를 사라,하지만됩니다

**** Update2 : 앱 통찰력 데이터를 보내려면 샘플 C# 콘솔 응용 프로그램을 작성하고 거기에는 행운이 없습니다. 트래픽을 모니터링하기 위해 피들러를 사용하고 있습니다. 응용 프로그램 통찰력 아직 피들러와 자바 (how to Capture https with fiddler, in java) 나는 https://dc.services.visualstudio.com/v2/track으로 아웃 바운드 트래픽을 캡처 할 수 있었다, 그러나와 약간의 재생 후 아무것도가 없었다 : 나는 몇 가지 흥미로운 아웃 바운드 HTTP가

는 **** 갱신 3가 요청 보는 경우에 업데이트됩니다 리소스 포털

+0

netbeans IDE를 사용하여 프로젝트에서 프로파일 링을 수행하고 위에서 언급 한 것과 같은 오류가 발생했습니다. – funnyCoder

답변

0

최신 버전의 SDK의 회귀인지 또는 앱의 특정 문제인지 확인하려면 SDK 버전 1.0.5에서도 이와 같은 현상이 발생하는지 확인하십시오.

감사

그것은 작동
+0

1.0.5로 다운 그레이드되었으며 로그의 일부 ........ ................... AI : TRACE 30-10-2016 09:34, 1 : PC 'JSDK_ProcessCpuPerformanceCounter'등록 AI : TRACE 30-10-2016 09:34 , 1 : PC 'JSDK_WindowsPerformanceCounterAsPC'등록 AI : TRACE 30-10-2016 09:34, 1 : 원격 측정을 전송하는 InProcessTelemetryChannel AI : ERROR 30-10-2016 09:34, 17 : 소켓 시간 초과 예외를 보내지 못했습니다. – funnyCoder

+0

생각. 플러시 후에 (즉, 프로그램이 종료되기 전에) 수면을 추가 할 수 있습니까? 이렇게하면 flush의 비동기 부분을 완료 할 수 있습니다. – oyosefi

+0

그것은 작동합니다. 혼란이있었습니다. 사용자 지정 이벤트를 보내고 있었지만 포털에서 요청 이벤트를 찾고 있었으므로 아무 것도 보지 못했습니다. 그것은 나를 위해 절대적으로 잘 작동합니다. 그것은 내가 혼란스럽게 만든 포털 UI입니다 – funnyCoder

0

, 혼란, 나는 사용자 정의 이벤트를 전송했지만 포털에서 나는 내가 아무것도 표시되지 않는 한 요청 이벤트를 찾고 있었다가 있었다. 그것은 나를 위해 절대적으로 잘 작동합니다.

+0

그래서 궁극적으로이 문제가 해결 되었습니까? – terminatur