有奖捉虫:办公协同&微信生态&物联网文档专题 HOT

操作场景

该任务指导您使用服务监控功能。

前提条件

开始实践服务监控功能前,请确保已完成了 SDK 下载

操作步骤

向工程中添加 spring-cloud-tsf-starter 依赖并开启 @EnableTsf 注解,详情请参见 Demo 工程概述 文档。
注意
如果您使用的是 1.15.0-Edgware-RELEASE/1.15.0-Finchley-RELEASE 及之前的版本,使用方法参见 Spring Cloud SDK 历史版本使用方法

Finchley 版本 SDK 相关设置

1. 向工程中添加依赖。在 pom.xml 中添加以下代码,依赖的是 spring-cloud-tsf-sleuth 而不是 spring-cloud-tsf-monitor
<dependency>
<groupId>com.tencent.tsf</groupId>
<artifactId>spring-cloud-tsf-sleuth</artifactId>
<version><!-- 调整为 SDK 最新版本号 --></version>
</dependency>
2. 向 Application 类中添加注解 @EnableTsfMonitor
// 下面省略了无关的代码
import com.tencent.tsf.monitor.annotation.EnableTsfMonitor;
@SpringBootApplication
@EnableTsfMonitor
public class ProviderApplication {
public static void main(String[] args) {
SpringApplication.run(ProviderApplication.class, args);
}
}