一、添加依赖:
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-logback-1.x</artifactId>
<version>8.7.0</version>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-trace</artifactId>
<version>8.7.0</version>
</dependency>
二、在普通业务方法添加@Trace注解:
@Trace
public String myBusiness(){
return "my business";
}
三、在skywalking UI界面可以看到普通业务方法:
可以通过@Tag注解来在skywalking里显示调用的参数和返回值
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"),
@Tag(key = "result", value = "returnedObj")})
public int get(Integer id) {
return id;
}