소스 검색

项目功能优化

liukaixiong 4 년 전
부모
커밋
c493d1074f

+ 13 - 0
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/models/entity/JayMonitorMq.java

@@ -87,6 +87,11 @@ public class JayMonitorMq implements Serializable {
      */
     private Integer status;
 
+    /**
+     * 请求时长
+     */
+    private Long requestTime;
+
     /**
      * 数据来源时间
      */
@@ -97,6 +102,14 @@ public class JayMonitorMq implements Serializable {
      */
     private Date createdTime;
 
+    public Long getRequestTime() {
+        return requestTime;
+    }
+
+    public void setRequestTime(Long requestTime) {
+        this.requestTime = requestTime;
+    }
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {

+ 2 - 1
jay-monitor-data-server/src/main/java/com/jay/monitor/data/server/store/mysql/MysqlMQStoreProcess.java

@@ -98,7 +98,7 @@ public class MysqlMQStoreProcess extends AbstractStoreProcess<MQDataDTO, JayMoni
 
     @Override
     public List<JayMonitorMq> searchDataByList(String date, Integer pageSize, JayMonitorMq entity) throws Exception {
-        List<JayMonitorMq> resultList = mqMapper.selectPartitionByList(date,pageSize, entity);
+        List<JayMonitorMq> resultList = mqMapper.selectPartitionByList(date, pageSize, entity);
         return resultList;
     }
 
@@ -114,6 +114,7 @@ public class MysqlMQStoreProcess extends AbstractStoreProcess<MQDataDTO, JayMoni
             mqData.setDataId(request.getDataId());
             mqData.setLogId(request.getLogId());
             mqData.setInvokeType(request.getInvokeType().name());
+            mqData.setRequestTime(request.getRequestTime());
         } catch (Exception e) {
             logger.error("builderJayMonitorMq", e);
         }

+ 7 - 3
jay-monitor-data-server/src/main/resources/mybatis/mapper/JayMonitorMqMapperExt.xml

@@ -8,7 +8,7 @@
         msg_id, data_group_name, data_group_key,
         data_id, root_log_id, parent_log_id,
         log_id, `status`, source_time,
-        created_time)
+        created_time, request_time)
         values
         <foreach collection="list" item="item" index="index" separator=",">
             (
@@ -19,7 +19,8 @@
             #{item.dataGroupKey,jdbcType=VARCHAR},
             #{item.dataId,jdbcType=VARCHAR}, #{item.rootLogId,jdbcType=VARCHAR}, #{item.parentLogId,jdbcType=VARCHAR},
             #{item.logId,jdbcType=VARCHAR}, #{item.status,jdbcType=INTEGER}, #{item.sourceTime,jdbcType=TIMESTAMP},
-            #{item.createdTime,jdbcType=TIMESTAMP}
+            #{item.createdTime,jdbcType=TIMESTAMP},
+            #{item.requestTime,jdbcType=INTEGER}
             )
         </foreach>
     </insert>
@@ -27,7 +28,7 @@
     <sql id="Base_Column_List">
     id, application_name, application_ip, mq_type, invoke_type, topic, partition_name,
     msg_id, data_group_name, data_group_key, data_id, root_log_id, parent_log_id, log_id,
-    `status`, source_time, created_time
+    `status`, source_time, created_time,request_time
   </sql>
 
     <select id="selectPartitionById" resultType="com.jay.monitor.data.server.models.entity.JayMonitorMq">
@@ -96,6 +97,9 @@
             <if test="record.createdTime != null and record.createdTime != ''">
                 AND created_time = #{record.createdTime,jdbcType=TIMESTAMP}
             </if>
+            <if test="record.requestTime != null and record.requestTime != ''">
+                AND request_time >= #{record.requestTime,jdbcType=INTEGER}
+            </if>
         </where>
         order by id desc limit ${pageSize}
     </sql>

+ 9 - 5
jay-monitor-data-server/src/main/resources/templates/trace/mqList.html

@@ -54,7 +54,7 @@
                 <div class="layui-inline">
                     <label class="layui-form-label">索引编号</label>
                     <div class="layui-input-block">
-                        <input code="text" class="layui-input" name="dataId" id="data_id" >
+                        <input code="text" class="layui-input" name="dataId" id="data_id">
                     </div>
                 </div>
             </div>
@@ -133,19 +133,23 @@
                 field: 'dataId', title: '索引编号', width: 100
             }, {
                 field: 'rootLogId', title: '链路顶层编号', hide: true, templet: function (res) {
-                    return '<em><a href="'+catUrl+ res.rootLogId + '"  target="_blank">顶层日志</a></em>'
+                    return '<em><a href="' + catUrl + res.rootLogId + '"  target="_blank">顶层日志</a></em>'
                 }
             }, {
                 field: 'parentLogId', title: '链路上级编号', templet: function (res) {
-                    return '<em><a href="'+catUrl + res.parentLogId + '"  target="_blank">上层日志</a></em>'
+                    return '<em><a href="' + catUrl + res.parentLogId + '"  target="_blank">上层日志</a></em>'
                 }
             }, {
                 field: 'logId', title: '链路编号', rowspan: 2, width: 100, templet: function (res) {
-                    return '<em><a href="'+catUrl + res.logId + '" target="_blank">当前日志</a></em>'
+                    return '<em><a href="' + catUrl + res.logId + '" target="_blank">当前日志</a></em>'
                 }
             }, {
                 field: 'status', title: '是否有效', rowspan: 1, width: 80, templet: function (res) {
-                    return '<em>' + elab_common.getConfigTypeText("common_status", res.status) + '</em>'
+                    var styleString = "style=\"color: red;\"";
+                    if (res.status == 1) {
+                        styleString = "style=\"color: #5fb878;\"";
+                    }
+                    return '<em ' + styleString + '>' + elab_common.getConfigTypeText("common_status", res.status) + '</em>'
                 }
             }
             ,

+ 15 - 3
jay-monitor-data-server/src/main/resources/templates/trace/urlList.html

@@ -80,7 +80,7 @@
                 <div class="layui-inline">
                     <label class="layui-form-label">状态码</label>
                     <div class="layui-input-block">
-                        <input code="text" class="layui-input" name="requestTime" id="status" value="">
+                        <input code="text" class="layui-input" name="status" id="status" value="">
                     </div>
                 </div>
             </div>
@@ -143,11 +143,23 @@
                 }
             },
             {
-                field: 'status', title: '是否有效', rowspan: 1
+                field: 'status', title: '是否有效', rowspan: 1, templet: function (res) {
+                    var styleString = "style=\"color: red;\"";
+                    if (res.status == 200) {
+                        styleString = "style=\"color: #5fb878;\"";
+                    }
+                    return '<em ' + styleString + '>' + res.status + '</em>'
+                }
             }
             ,
             {
-                field: 'requestTime', title: '请求时长',sort: true
+                field: 'requestTime', title: '请求时长', sort: true, templet: function (res) {
+                    var styleString = "style=\"color: red;\"";
+                    if (res.requestTime < 500) {
+                        styleString = "style=\"color: #5fb878;\"";
+                    }
+                    return '<em ' + styleString + '>' + res.requestTime + '</em>'
+                }
             }
             , {
                 field: 'createdTime', title: '创建时间', width: 160, templet: function (res) {