- 部署探针
- 打开idea开发工具Run-》Edit Configurations
- 点击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"; } }
标签:mylesson,springboot,service,jar,agent,监控,skywalking,Dskywalking From: https://www.cnblogs.com/personblog/p/17307326.html