🔨 监控逻辑.

This commit is contained in:
lijiahangmax
2025-09-09 21:25:44 +08:00
parent 3c75aedcec
commit 0b7faa038a
229 changed files with 13303 additions and 358 deletions

View File

@@ -53,21 +53,23 @@ public interface AutoConfigureOrderConst {
int FRAMEWORK_REDIS_CACHE = Integer.MIN_VALUE + 2000;
int FRAMEWORK_CONFIG = Integer.MIN_VALUE + 2100;
int FRAMEWORK_INFLUXDB = Integer.MIN_VALUE + 2100;
int FRAMEWORK_ENCRYPT = Integer.MIN_VALUE + 2200;
int FRAMEWORK_CONFIG = Integer.MIN_VALUE + 2300;
int FRAMEWORK_STORAGE = Integer.MIN_VALUE + 2300;
int FRAMEWORK_CYPHER = Integer.MIN_VALUE + 2400;
int FRAMEWORK_JOB = Integer.MIN_VALUE + 2400;
int FRAMEWORK_STORAGE = Integer.MIN_VALUE + 2500;
int FRAMEWORK_JOB_QUARTZ = Integer.MIN_VALUE + 2500;
int FRAMEWORK_JOB = Integer.MIN_VALUE + 2600;
int FRAMEWORK_JOB_ASYNC = Integer.MIN_VALUE + 2600;
int FRAMEWORK_JOB_QUARTZ = Integer.MIN_VALUE + 2700;
int FRAMEWORK_MONITOR = Integer.MIN_VALUE + 2700;
int FRAMEWORK_JOB_ASYNC = Integer.MIN_VALUE + 2800;
int FRAMEWORK_BIZ_OPERATOR_LOG = Integer.MIN_VALUE + 2800;
int FRAMEWORK_MONITOR = Integer.MIN_VALUE + 2900;
int FRAMEWORK_BIZ_OPERATOR_LOG = Integer.MIN_VALUE + 3000;
int FRAMEWORK_BANNER = Integer.MIN_VALUE + 10000;

View File

@@ -31,24 +31,29 @@ package org.dromara.visor.common.constant;
*/
public interface BeanOrderConst {
/**
* 公共返回值包装处理器
*/
int RESPONSE_ADVICE_WRAPPER = Integer.MIN_VALUE + 1000;
/**
* 演示模式切面
*/
int DEMO_DISABLE_API_ASPECT = Integer.MIN_VALUE + 10;
int DEMO_DISABLE_API_ASPECT = Integer.MIN_VALUE + 100;
/**
* 全局日志打印
*/
int LOG_PRINT_ASPECT = Integer.MIN_VALUE + 20;
int LOG_PRINT_ASPECT = Integer.MIN_VALUE + 200;
/**
* 暴露接口切面
*/
int EXPOSE_API_ASPECT = Integer.MIN_VALUE + 300;
/**
* 操作日志切面
*/
int OPERATOR_LOG_ASPECT = Integer.MIN_VALUE + 30;
int OPERATOR_LOG_ASPECT = Integer.MIN_VALUE + 400;
/**
* 公共返回值包装处理器
*/
int RESPONSE_ADVICE_WRAPPER = Integer.MIN_VALUE + 1000;
}

View File

@@ -33,4 +33,8 @@ public interface CustomHeaderConst {
String APP_VERSION = "X-App-Version";
String AGENT_KEY_HEADER = "X-Agent-Key";
String AGENT_VERSION_HEADER = "X-Agent-Version";
}

View File

@@ -48,6 +48,8 @@ public enum ErrorCode implements CodeInfo {
UNAUTHORIZED(401, "当前认证信息已失效, 请重新登录"),
EXPOSE_UNAUTHORIZED(401, "当前认证信息错误, 请检查后重试"),
FORBIDDEN(403, "无操作权限"),
NOT_FOUND(404, "未找到该资源"),

View File

@@ -102,7 +102,7 @@ public interface ErrorMessage {
String HOST_TYPE_ERROR = "主机类型错误";
String HOST_NOT_ENABLED = "主机未启用";
String HOST_NOT_ENABLED = "{} 主机未启用";
String CONFIG_NOT_ENABLED = "配置未启用";
@@ -146,6 +146,8 @@ public interface ErrorMessage {
String FILE_ABSENT = "文件不存在";
String FILE_EXTENSION_TYPE = "文件类型不正确";
String FILE_ABSENT_CLEAR = "文件不存在 (可能已被清理)";
String LOG_ABSENT = "日志不存在";
@@ -158,6 +160,8 @@ public interface ErrorMessage {
String FILE_UPLOAD_ERROR = "文件上传失败";
String CALC_SIGN_FAILED = "计算签名失败";
String SCRIPT_UPLOAD_ERROR = "脚本上传失败";
String EXEC_ERROR = "执行失败";
@@ -182,6 +186,8 @@ public interface ErrorMessage {
String COMPRESS_FILE_ABSENT = "压缩文件不存在";
String DECOMPRESS_FILE_ABSENT = "压缩文件不存在";
String UNABLE_DOWNLOAD_FOLDER = "无法下载文件夹";
String VALID_ERROR = "验证失败";
@@ -209,6 +215,27 @@ public interface ErrorMessage {
|| ex instanceof ApplicationException;
}
/**
* 获取错误信息
*
* @param ex ex
* @return message
*/
static String getErrorMessage(Exception ex) {
return getErrorMessage(ex, ErrorMessage.EXEC_ERROR, 0);
}
/**
* 获取错误信息
*
* @param ex ex
* @param len len
* @return message
*/
static String getErrorMessage(Exception ex, int len) {
return getErrorMessage(ex, ErrorMessage.EXEC_ERROR, len);
}
/**
* 获取错误信息
*
@@ -217,6 +244,18 @@ public interface ErrorMessage {
* @return message
*/
static String getErrorMessage(Exception ex, String defaultMsg) {
return getErrorMessage(ex, defaultMsg, 0);
}
/**
* 获取错误信息
*
* @param ex ex
* @param defaultMsg defaultMsg
* @param len len
* @return message
*/
static String getErrorMessage(Exception ex, String defaultMsg, int len) {
if (ex == null) {
return null;
}
@@ -226,7 +265,11 @@ public interface ErrorMessage {
}
// 业务异常
if (isBizException(ex)) {
return message;
if (len > 0) {
return Strings.retain(message, len);
} else {
return message;
}
}
return defaultMsg;
}

View File

@@ -35,6 +35,8 @@ public interface ExtraFieldConst extends FieldConst {
String TRACE_ID = "traceId";
String TASK_ID = "taskId";
String IDENTITY = "identity";
String GROUP_NAME = "groupName";
@@ -69,4 +71,6 @@ public interface ExtraFieldConst extends FieldConst {
String DARK = "dark";
String AGENT_KEY = "agentKey";
}

View File

@@ -45,12 +45,18 @@ public interface FieldConst {
String LABEL = "label";
String FIELD = "field";
String TYPE = "type";
String COLOR = "color";
String LOADING = "loading";
String STATUS = "status";
String SWITCH = "switch";
String INFO = "info";
String EXTRA = "extra";
@@ -71,6 +77,8 @@ public interface FieldConst {
String SEQ = "seq";
String START = "start";
String PATH = "path";
String ADDRESS = "address";
@@ -119,4 +127,12 @@ public interface FieldConst {
String CONFIG = "config";
String VERSION = "version";
String SYNCED = "synced";
String SIGN = "sign";
String SIGN_SHORT = "signShort";
}

View File

@@ -37,4 +37,16 @@ public interface FileConst {
String SCRIPT = "script";
String AGENT = "agent";
String AGENT_RELEASE = "agent-release";
String AGENT_RELEASE_TEMP = "agent-release-temp";
String AGENT_RELEASE_TAR_GZ = "agent-release.tar.gz";
String VERSION = ".version";
String CONFIG_YAML = "config.yaml";
}

View File

@@ -0,0 +1,60 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.common.entity.chart;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
import java.util.Map;
/**
* 时序图系列
*
* @author Jiahang Li
* @version 1.0.0
* @since 2025/9/3 21:08
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "TimeChartSeries", description = "时序图系列")
public class TimeChartSeries {
@Schema(description = "name")
private String name;
@Schema(description = "颜色")
private String color;
@Schema(description = "tags")
private Map<String, Object> tags;
@Schema(description = "数据 [0]timestampMills [1]value")
private List<List<Object>> data;
}

View File

@@ -63,6 +63,9 @@ public class BaseConnectConfig implements IBaseConnectConfig {
@Schema(description = "主机端口")
private Integer hostPort;
@Schema(description = "agentKey")
private String agentKey;
@Schema(description = "用户名")
private String username;

View File

@@ -61,6 +61,10 @@ public interface IBaseConnectConfig {
void setHostPort(Integer hostPort);
String getAgentKey();
void setAgentKey(String agentKey);
String getUsername();
void setUsername(String username);

View File

@@ -23,7 +23,7 @@
package org.dromara.visor.common.validator.group;
/**
* 分页验证分组
* id 验证分组
*
* @author Jiahang Li
* @version 1.0.0

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.common.validator.group;
/**
* key 验证分组
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/9/1 19:13
*/
public interface Key {
}