如何在Spring Boot应用程序中设置变量InstrumentationKey进行天蓝色监测

时间:2019-03-04 10:56:24

标签: java azure azure-application-insights azure-monitoring

我在Spring Boot项目中设置天蓝色监视时遇到问题。

每次启动时我都有错误:

  

instrumentationKey必须设置为向Azure Monitor报告指标。

我已将application.properties设置为具有以下属性:

  

azure.application-insights.instrumentation-key = VALID-UUID

     

spring.application.name = test

项目的依赖关系如下:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>2.1.3</version>
    </dependency>
    <dependency>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>azure-spring-boot-metrics-starter</artifactId>
        <version>2.1.4</version>
    </dependency>

2 个答案:

答案 0 :(得分:1)

根据此https://docs.microsoft.com/en-us/azure/azure-monitor/app/micrometer-java#using-spring-2x文档,您还需要添加application-insights-springboot-starter。

否则,您可以将密钥设置为azuremonitor.instrumentationKey。我的建议是将application-insights-springboot-starter和azure-spring-boot-metrics-starter一起添加

答案 1 :(得分:0)

依存方式跟踪

您的错误消息来自AzureMonitorConfig

所以我认为关键是修改为

azuremonitor.instrumentationKey
相关问题