Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete the code comment translation of the common module #1766

Merged
merged 4 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<scope>provided</scope>
</dependency>
<!-- 表达式计算 -->
<!-- Expression evaluation -->
<dependency>
<groupId>com.googlecode.aviator</groupId>
<artifactId>aviator</artifactId>
</dependency>
<!-- 工具依赖 -->
<!-- Tool dependencies -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand All @@ -87,7 +87,7 @@
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
</dependency>
<!-- 使用apache.http.conn.util代替sun.net.util -->
<!-- Use apache.http.conn.util instead of sun.net.util -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@ public class AviatorConfiguration {
public AviatorEvaluatorInstance configAviatorEvaluator() {
AviatorEvaluatorInstance instance = AviatorEvaluator.getInstance();

// 配置AviatorEvaluator使用LRU缓存编译后的表达式
// Configure AviatorEvaluator to cache compiled expressions using LRU
instance
.useLRUExpressionCache(AVIATOR_LRU_CACHE_SIZE)
.addFunction(new StrEqualFunction());

// limit loop 限制循环次数
// limit loop Limit the number of loops
instance.setOption(Options.MAX_LOOP_COUNT, 10);

// 启用部分Aviator语法特性集合
// Enables a partial Aviator syntax feature collection
instance.setOption(Options.FEATURE_SET,
Feature.asSet(Feature.If,
Feature.Assignment,
Feature.Let,
Feature.StringInterpolation));

// 配置自定义aviator函数
// Configure the custom aviator function
instance.addOpFunction(OperatorType.BIT_OR, new AbstractFunction() {
@Override
public AviatorObject call(final Map<String, Object> env, final AviatorObject arg1,
Expand Down Expand Up @@ -98,7 +98,7 @@ public String getName() {
}

/**
* 自定义aviator判断字符串是否相等函数
* Define a custom aviator string equality function
*/
private static class StrEqualFunction extends AbstractFunction {
@Override
Expand All @@ -123,7 +123,7 @@ public String getName() {
}

/**
* 自定义aviator判断字符串1是否包含字符串2 (case-insensitive)
* Custom aviator determines whether string 1 contains string 2 (case-insensitive)
*/
private static class StrContainsFunction extends AbstractFunction {
@Override
Expand All @@ -148,7 +148,7 @@ public String getName() {
}

/**
* 自定义aviator判断环境中此对象是否存在值
* Custom aviator determines if a value exists for this object in the environment
*/
private static class ObjectExistsFunction extends AbstractFunction {
@Override
Expand All @@ -172,8 +172,8 @@ public String getName() {
}

/**
* 自定义aviator判断字符串是否匹配regex
* - regex需要加上""或者''
* Custom aviator determines if a string matches a regex
* - regex You need to add "" or ''
*/
private static class StrMatchesFunction extends AbstractFunction {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public enum QueueType {
*/
public static class KafkaProperties {
/**
* kafka的连接服务器url
* kafka's connection server url
*/
private String servers;
/**
Expand Down Expand Up @@ -167,27 +167,27 @@ public void setTencent(TencentSmsProperties tencent) {
public static class TencentSmsProperties {

/**
* 腾讯云账户访问密钥id
* Tencent cloud account secret id
*/
private String secretId;

/**
* 腾讯云账户访问密钥key
* Tencent cloud account secret key
*/
private String secretKey;

/**
* SMS短信应用app id
* SMS app id
*/
private String appId;

/**
* 短信签名
* SMS signature
*/
private String signName;

/**
* 短信模版ID
* SMS template ID
*/
private String templateId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,140 +24,117 @@ public interface CommonConstants {

/**
* Response status code: generic success
* 响应状态码: 通用成功
*/
byte SUCCESS_CODE = 0x00;

/**
* Response status code: generic failure
* 响应状态码: 通用失败
*/
byte FAIL_CODE = 0x0F;

/**
* Response status code: Parameter verification failed
* 响应状态码: 参数校验失败
*/
byte PARAM_INVALID_CODE = 0x01;

/**
* Response Status Code: Probe Failed
* 响应状态码: 探测失败
*/
byte DETECT_FAILED_CODE = 0x02;

/**
* Response status code: monitoring does not exist
* 响应状态码: 监控不存在
*/
byte MONITOR_NOT_EXIST_CODE = 0x03;

/**
* Response Status Code: Monitor Service Conflict
* 响应状态码: 监控服务冲突
*/
byte MONITOR_CONFLICT_CODE = 0x04;

/**
* Response status code: Incorrect login account password
* 响应状态码: 登录账户密码错误
*/
byte MONITOR_LOGIN_FAILED_CODE = 0x05;

/**
* Response status code: Registration failed exception
* 响应状态码: 注册失败异常
*/
byte MONITOR_REGISTER_FAILED_CODE = 0x06;


/**
* Monitoring Status Code: Unmonitored
* 任务状态码: 未监控
*/
byte UN_MANAGE_CODE = 0x00;

/**
* Monitoring Status Code: Available
* 任务状态码: 可用
*/
byte AVAILABLE_CODE = 0x01;

/**
* Monitoring Status Code: Not Available
* 任务状态码: 不可用
*/
byte UN_AVAILABLE_CODE = 0x02;

/**
* Alarm status: 0 - normal alarm (to be processed)
* 告警状态: 0-正常告警(待处理)
*/
byte ALERT_STATUS_CODE_PENDING = 0x00;

/**
* Alarm Status: 1 - Threshold triggered but not reached the number of alarms
* 告警状态: 1-阈值触发但未达到告警次数
*/
byte ALERT_STATUS_CODE_NOT_REACH = 0x01;

/**
* Alarm Status: 2-Restore Alarm
* 告警状态: 2-恢复告警
*/
byte ALERT_STATUS_CODE_RESTORED = 0x02;

/**
* Alert Status: 3-Handled
* 告警状态: 3-已处理
*/
byte ALERT_STATUS_CODE_SOLVED = 0x03;

/**
* Alarm level: 0: high-emergency-emergency-red
* 告警级别: 0:高-emergency-紧急告警-红色
*/
byte ALERT_PRIORITY_CODE_EMERGENCY = 0x00;

/**
* Alarm severity: 1: medium-critical-critical alarm-orange
* 告警级别: 1:中-critical-严重告警-橙色
*/
byte ALERT_PRIORITY_CODE_CRITICAL = 0x01;

/**
* Warning level: 2: low-warning-warning warning-yellow
* 告警级别: 2:低-warning-警告告警-黄色
*/
byte ALERT_PRIORITY_CODE_WARNING = 0x02;

/**
* Field parameter type: number
* 字段参数类型: 数字
*/
byte TYPE_NUMBER = 0;

/**
* Field parameter type: String
* 字段参数类型: 字符串
*/
byte TYPE_STRING = 1;

/**
* Field parameter type: encrypted string
* 字段参数类型: 加密字符串
*/
byte TYPE_SECRET = 2;

/**
* Field parameter type: time
* 字段参数类型: 时间
*/
byte TYPE_TIME = 3;

/**
* Collection metric value: null placeholder for empty value
* 采集指标值:null空值占位符
*/
String NULL_VALUE = "&nbsp;";

Expand All @@ -172,25 +149,22 @@ public interface CommonConstants {
String PROM_VALUE = "value";

/**
* Availability 监控总可用性指标
* Monitor total availability metrics
*/
String AVAILABILITY = "availability";

/**
* Parameter Type Number
* 参数类型 数字
*/
byte PARAM_TYPE_NUMBER = 0;

/**
* Parameter Type String
* 参数类型 字符串
*/
byte PARAM_TYPE_STRING = 1;

/**
* Parameter Type Password
* 参数类型 密码
*/
byte PARAM_TYPE_PASSWORD = 2;

Expand All @@ -206,75 +180,71 @@ public interface CommonConstants {

/**
* Authentication type Account password
* 认证类型 账户密码
*/
byte AUTH_TYPE_PASSWORD = 1;

/**
* Authentication type GITHUB three-party login
* 认证类型 GITHUB三方登录
* Authentication type GitHub three-party login
*/
byte AUTH_TYPE_GITHUB = 2;

/**
* Authentication type WeChat three-party login
* 认证类型 微信三方登录
*/
byte AUTH_TYPE_WEIXIN = 3;

/**
* Authentication type GITEE three-party login
* 认证类型 GITEE三方登录
*/
byte AUTH_TYPE_GITEE = 5;

/**
* 内有标签: monitorId 监控任务ID
* Inside the tag: monitorId Monitor task ID
*/
String TAG_MONITOR_ID = "monitorId";

/**
* 内有标签: monitorName 任务名称
* Inside the tag: monitorName Task name
*/
String TAG_MONITOR_NAME = "monitorName";

/**
* 内有标签: monitorHost 任务主机
* Inside the tag: monitorHost Task host
*/
String TAG_MONITOR_HOST = "monitorHost";

/**
* 内有标签: policyId 告警阈值规则ID
* Inside the tag: policyId Alarm threshold rule ID
*/
String TAG_THRESHOLD_ID = "thresholdId";

/**
* 内有标签: app 监控类型
* Inside the tag: app Type of monitoring
*/
String TAG_MONITOR_APP = "app";

/**
* 内有标签: metrics
* Inside the tag: metrics
*/
String TAG_METRICS = "metrics";

/**
* 内有标签: metric
* Inside the tag: metric
*/
String TAG_METRIC = "metric";

/**
* 内有标签: code
* Inside the tag: code
*/
String TAG_CODE = "code";

/**
* notice_period type 类型字段, 每日类型
* notice_period type Type field, daily type
*/
int NOTICE_PERIOD_DAILY = 0;

/**
* key为receiver.id, value为noticePeriod的缓存key前缀
* key is receiver.id, value is noticePeriod cache key prefix
*/
String RECEIVER_NOTICE_PERIOD_CACHE_PREFIX = "receiver_notice_period:";

Expand Down Expand Up @@ -315,7 +285,7 @@ public interface CommonConstants {

/**
* ignore label
* 处理未配置恢复告警,但需要使用恢复告警变更任务状态的情况
* Handle situations where recovery alarms are not configured, but need to be used to change task state
*/
String IGNORE = "ignore";

Expand Down
Loading
Loading