skywalking 监控 springboot项目

 

  • 部署探针
  1. 打开idea开发工具Run-》Edit Configurations
  2. 点击Modify options -》Add VM option

-javaagent:E:\projectdeploy\apache-skywalking-apm-9.2.0\apache-skywalking-apm-bin\agent\skywalking-agent.jar
-Dskywalking.agent.service_name=service-mylesson

-javaagent:用于指定探针路径
-Dskywalking.agent.service_name:用于重写 agent/config/agent.config 配置文件中的服务名

-Dskywalking.collector.backend_service:用于重写 agent/config/agent.config 配置文件中的服务地址

  • 使用java命令启动方式
java -javaagent:E:\projectdeploy\apache-skywalking-apm-9.2.0\apache-skywalking-apm-bin\agent\skywalking-agent.jar=-Dskywalking.agent.service_name=service-mylesson,-Dskywalking.collector.backend_service=localhost:8090 -jar mylesson.jar
  • 调用接口后,展示效果
复制代码
package com.example.mylesson.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProductController {

    @ResponseBody
    @RequestMapping(value = { "product/test" }, method = RequestMethod.GET)
    public String selectUserByName() throws InterruptedException {
        Thread.sleep(5000);
        return "hello";
    }
}
复制代码

 

 

posted @   低调码农哥!  阅读(261)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
点击右上角即可分享
微信分享提示