Commit e65488265d744522cc58f73756188fe8275aaf1f
1 parent
33412466
UI 界面,增加 skywalking 作为日志中心
Showing
7 changed files
with
37 additions
and
8 deletions
bin/deploy.sh
| ... | ... | @@ -27,6 +27,7 @@ JAVA_OPS="-Xms512m -Xmx512m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$HE |
| 27 | 27 | export SW_AGENT_NAME=$SERVER_NAME |
| 28 | 28 | export SW_AGENT_COLLECTOR_BACKEND_SERVICES=192.168.0.84:11800 |
| 29 | 29 | export SW_GRPC_LOG_SERVER_HOST=192.168.0.84 |
| 30 | +export SW_AGENT_TRACE_IGNORE_PATH="Redisson/PING,/actuator/**,/admin/**" | |
| 30 | 31 | export JAVA_AGENT=-javaagent:/work/skywalking/apache-skywalking-apm-bin/agent/skywalking-agent.jar |
| 31 | 32 | |
| 32 | 33 | # 备份 | ... | ... |
ruoyi-ui/src/views/infra/skywalking/index.vue
| ... | ... | @@ -8,7 +8,7 @@ export default { |
| 8 | 8 | name: "SkyWalking", |
| 9 | 9 | data() { |
| 10 | 10 | return { |
| 11 | - src: "http://skywalking.shop.iocoder.cn", // TODO 芋艿,后续改成配置读取 | |
| 11 | + src: "http://skywalking.shop.iocoder.cn/trace", // TODO 芋艿,后续改成配置读取 | |
| 12 | 12 | height: document.documentElement.clientHeight - 94.5 + "px;", |
| 13 | 13 | loading: true |
| 14 | 14 | }; | ... | ... |
ruoyi-ui/src/views/infra/skywalking/log.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div v-loading="loading" :style="'height:'+ height"> | |
| 3 | + <iframe :src="src" frameborder="no" style="width: 100%;height: 100%" scrolling="auto" /> | |
| 4 | + </div> | |
| 5 | +</template> | |
| 6 | +<script> | |
| 7 | +export default { | |
| 8 | + name: "SkyWalking-Log", | |
| 9 | + data() { | |
| 10 | + return { | |
| 11 | + src: "http://skywalking.shop.iocoder.cn/log", // TODO 芋艿,后续改成配置读取 | |
| 12 | + height: document.documentElement.clientHeight - 94.5 + "px;", | |
| 13 | + loading: true | |
| 14 | + }; | |
| 15 | + }, | |
| 16 | + mounted: function() { | |
| 17 | + setTimeout(() => { | |
| 18 | + this.loading = false; | |
| 19 | + }, 230); | |
| 20 | + const that = this; | |
| 21 | + window.onresize = function temp() { | |
| 22 | + that.height = document.documentElement.clientHeight - 94.5 + "px;"; | |
| 23 | + }; | |
| 24 | + } | |
| 25 | +}; | |
| 26 | +</script> | ... | ... |
src/main/java/cn/iocoder/dashboard/framework/tracer/core/annotation/BizTrace.java
| ... | ... | @@ -5,6 +5,9 @@ import java.lang.annotation.*; |
| 5 | 5 | /** |
| 6 | 6 | * 打印业务编号 / 业务类型注解 |
| 7 | 7 | * |
| 8 | + * 使用时,需要设置 SkyWalking OAP Server 的 application.yaml 配置文件,修改 SW_SEARCHABLE_TAG_KEYS 配置项, | |
| 9 | + * 增加 biz.type 和 biz.id 两值,然后重启 SkyWalking OAP Server 服务器。 | |
| 10 | + * | |
| 8 | 11 | * @author 麻薯 |
| 9 | 12 | */ |
| 10 | 13 | @Target({ElementType.METHOD}) | ... | ... |
src/main/java/cn/iocoder/dashboard/framework/tracer/package-info.java
src/main/java/cn/iocoder/dashboard/modules/system/controller/auth/SysAuthController.java
| ... | ... | @@ -59,7 +59,6 @@ public class SysAuthController { |
| 59 | 59 | |
| 60 | 60 | @GetMapping("/get-permission-info") |
| 61 | 61 | @ApiOperation("获取登陆用户的权限信息") |
| 62 | - @BizTrace(id = "1", type = "'user'") | |
| 63 | 62 | public CommonResult<SysAuthPermissionInfoRespVO> getPermissionInfo() { |
| 64 | 63 | // 获得用户信息 |
| 65 | 64 | SysUserDO user = userService.getUser(getLoginUserId()); | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/tool/controller/test/ToolTestDemoController.java
| ... | ... | @@ -5,12 +5,11 @@ import cn.iocoder.dashboard.common.pojo.CommonResult; |
| 5 | 5 | import cn.iocoder.dashboard.common.pojo.PageResult; |
| 6 | 6 | import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils; |
| 7 | 7 | import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog; |
| 8 | +import cn.iocoder.dashboard.framework.tracer.core.annotation.BizTrace; | |
| 8 | 9 | import cn.iocoder.dashboard.modules.tool.controller.test.vo.*; |
| 9 | 10 | import cn.iocoder.dashboard.modules.tool.convert.test.ToolTestDemoConvert; |
| 10 | 11 | import cn.iocoder.dashboard.modules.tool.dal.dataobject.test.ToolTestDemoDO; |
| 11 | 12 | import cn.iocoder.dashboard.modules.tool.service.test.ToolTestDemoService; |
| 12 | -import com.baomidou.lock.annotation.Lock4j; | |
| 13 | -import io.github.resilience4j.ratelimiter.annotation.RateLimiter; | |
| 14 | 13 | import io.swagger.annotations.Api; |
| 15 | 14 | import io.swagger.annotations.ApiImplicitParam; |
| 16 | 15 | import io.swagger.annotations.ApiOperation; |
| ... | ... | @@ -66,7 +65,7 @@ public class ToolTestDemoController { |
| 66 | 65 | @ApiOperation("获得测试示例") |
| 67 | 66 | @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class) |
| 68 | 67 | @PreAuthorize("@ss.hasPermission('tool:test-demo:query')") |
| 69 | - @Lock4j // 分布式锁 | |
| 68 | +// @Lock4j // 分布式锁 | |
| 70 | 69 | public CommonResult<ToolTestDemoRespVO> getTestDemo(@RequestParam("id") Long id) { |
| 71 | 70 | if (true) { // 测试分布式锁 |
| 72 | 71 | ThreadUtil.sleep(5, TimeUnit.SECONDS); |
| ... | ... | @@ -79,7 +78,8 @@ public class ToolTestDemoController { |
| 79 | 78 | @ApiOperation("获得测试示例列表") |
| 80 | 79 | @ApiImplicitParam(name = "ids", value = "编号列表", required = true, dataTypeClass = List.class) |
| 81 | 80 | @PreAuthorize("@ss.hasPermission('tool:test-demo:query')") |
| 82 | - @RateLimiter(name = "backendA") | |
| 81 | +// @RateLimiter(name = "backendA") | |
| 82 | + @BizTrace(id = "1", type = "'user'") | |
| 83 | 83 | public CommonResult<List<ToolTestDemoRespVO>> getTestDemoList(@RequestParam("ids") Collection<Long> ids) { |
| 84 | 84 | List<ToolTestDemoDO> list = testDemoService.getTestDemoList(ids); |
| 85 | 85 | return success(ToolTestDemoConvert.INSTANCE.convertList(list)); | ... | ... |