skywalking 服务间链路追踪 (4) --- 项目中追踪各个方法, 监测方法运行时间

依赖:

    <properties>
        <skywalking.version>6.2.0</skywalking.version
    </properties>
        
     <dependency>
        <groupId>org.apache.skywalking</groupId>
        <artifactId>apm-toolkit-trace</artifactId>
        <version>${skywalking.version}</version>
     </dependency>

使用: 在需要追踪的方法上添加注解

@Trace
    @Trace
    public void listen(List<ConsumerRecord<String, String>> records, Acknowledgment ack){
    
        List<MilestoneInfo>  milestoneList = convert2Milestone(records);
        saveWorkTable(milestoneList);
        pileUpMllist.addAll(milestoneList);
        if(pileUpMllist.size()>=pileUpSize){
            doPushAndcClearPileUp();
        }
        ack.acknowledge();
        
    }

查看:进入后台, 选则你服务, 选择追踪的时间,就可以看到

原文地址:https://www.cnblogs.com/lshan/p/11274151.html