我正在使用 spring boot version 2.0.0 我正在使用 applicationInsight-web和core jar 2.1.0 我还在applicaionInsight.xml中添加了 instrumantation key 。
答案 0 :(得分:1)
请参阅https://docs.microsoft.com/en-us/azure/application-insights/app-insights-java-get-started#4-add-an-http-filter 它显示了如何为SpringBoot应用程序配置Application Insights Java SDK。
答案 1 :(得分:0)
这是我制作Spring-cloud + Azure Application Insight的配置。
pom.xml
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-spring-boot-starter</artifactId>
<version>1.2.0-BETA</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-logging-logback</artifactId>
<version>2.4.0-BETA</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
<dependency>
<groupId>io.opentracing.brave</groupId>
<artifactId>brave-opentracing</artifactId>
</dependency>
和dependenciesManagement
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>spring-cloud-azure-dependencies</artifactId>
<version>1.1.0.RC5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
logback-spring.xml
<appender name="aiAppender"
class="com.microsoft.applicationinsights.logback.ApplicationInsightsAppender">
<instrumentationKey>YOUR_INSTRUMENTATION_KEY</instrumentationKey>
</appender>
application.yml
azure:
application-insights:
instrumentation-key: YOUR_INSTRUMENTATION_KEY
祝你好运!