Skip to content

Commit

Permalink
Merge branch 'en-comment' of http://code.oppoer.me/idata/compass
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed Oct 8, 2023
2 parents 32b2fdb + 96e7fcf commit eed3468
Show file tree
Hide file tree
Showing 145 changed files with 856 additions and 854 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,26 @@
import java.util.List;

/**
* 分页数据封装
* Common Paging Data
*/
@Data
public class CommonPage<T> {

/**
* 总页数
* Total number of pages
*/
private Integer totalPage;
/**
* 总条数
* Total number of entries
*/
private Long total;
/**
* 分页数据
* Pagination data
*/
private List<T> list;

/**
* 将PageHelper分页后的list转为分页信息
* Convert a list paginated by PageHelper into pagination information.
*/
public static <T> CommonPage<T> restPage(List<T> list) {
CommonPage<T> result = new CommonPage<T>();
Expand All @@ -54,7 +54,7 @@ public static <T> CommonPage<T> restPage(List<T> list) {
}

/**
* 将SpringData分页后的list转为分页信息
* Convert Spring Data paginated list to pagination information
*/
public static <T> CommonPage<T> restPage(Page<T> pageInfo) {
CommonPage<T> result = new CommonPage<T>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@
import lombok.Data;

/**
* 通用返回对象
* Common Response Status
*/
@Data
public class CommonStatus<T> {

/**
* 状态码
* Status code
*/
private int code;
/**
* 提示信息
* Response message
*/
private String msg;
/**
* 数据封装
* Response data
*/
private T data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
package com.oppo.cloud.common.api;

/**
* 常用API返回对象接口
* Common API response object interface.
*/
public interface IErrorCode {

/**
* 返回码
* Status code
*/
int getCode();

/**
* 返回信息
* Response message
*/
String getMsg();
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
package com.oppo.cloud.common.api;

/**
* 常用API返回对象
* Common API response object.
*/
public enum StatusCode implements IErrorCode {

SUCCESS(200, "操作成功"),
SUCCESS(200, "Succeed"),

UNAUTHORIZED(401,"未授权"),
FAILED(500, "操作失败"),
VALIDATE_FAILED(404, "参数检验失败");
UNAUTHORIZED(401,"Unauthorized"),
FAILED(500, "Failed"),
VALIDATE_FAILED(404, "Parameter validation failed");

private int code;
private String msg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ public class RedisTemplateConfig {
@Bean
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {

// 创建redis模板对象
// Create a Redis template object.
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
// 设置连接工厂
// Set Connection Factory.
redisTemplate.setConnectionFactory(factory);
// Redis Key字符串序列化
// Redis Key serializer
redisTemplate.setKeySerializer(new StringRedisSerializer());

redisTemplate.setValueSerializer(new StringRedisSerializer());

redisTemplate.setHashKeySerializer(new StringRedisSerializer());

redisTemplate.setHashValueSerializer(new StringRedisSerializer());
// Redis 配置设置完成
// Redis configuration settings have been completed
redisTemplate.afterPropertiesSet();

return redisTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,67 +24,67 @@

public enum AppCategoryEnum {

// sql失败(语法,字段,权限,环境等
// sql failed(syntax, field, permission, environment, etc
SQL_FAILED("sqlFailed", "sql失败", "runError"),

// shuffle失败
// shuffle failed
SHUFFLE_FAILED("shuffleFailed", "shuffle失败", "runError"),

// 内存溢出
// memory overflow
MEMORY_OVERFLOW("memoryOverflow", "内存溢出", "runError"),

// 内存浪费
// memory waste
MEMORY_WASTE("memoryWaste", "内存浪费", "resourceUsage"),

// CPU浪费
// CPU waste
CPU_WASTE("cpuWaste", "CPU浪费", "resourceUsage"),

// 大表扫描
// large table scan
LARGE_TABLE_SCAN("largeTableScan", "大表扫描", "runPerformance"),

// oom预警
// oom warning
OOMWarn("oomWarn", "OOM预警", "runPerformance"),

// 数据倾斜
// data skew
DATA_SKEW("dataSkew", "数据倾斜", "runPerformance"),

// Job耗时异常
// Job duration abnormal
JOB_DURATION("jobDurationAbnormal", "Job耗时异常", "runPerformance"),

// Stage耗时异常
// Stage duration abnormal
STAGE_DURATION("stageDurationAbnormal", "Stage耗时异常", "runPerformance"),

// Task耗时异常
// Task duration abnormal
TASK_DURATION("taskDurationAbnormal", "Task长尾", "runPerformance"),

// Hdfs卡顿
// Hdfs stuck
HDFS_STUCK("hdfsStuck", "HDFS卡顿", "runPerformance"),

// 推测执行Task过多
// Speculative task is too many
SPECULATIVE_TASK("speculativeTask", "推测执行Task过多", "runPerformance"),

// 全局排序异常
// global sorting exception
GLOBAL_SORT("globalSortAbnormal", "全局排序异常", "runPerformance"),

// MapReduce内存浪费
// MapReduce memory waste
MR_MEMORY_WASTE("mrMemoryWaste", "MR内存浪费", "resourceUsage"),

// MapReduce大表扫描
// MapReduce large table scan
MR_LARGE_TABLE_SCAN("mrLargeTableScan", "MR大表扫描", "runPerformance"),

// MapReduce数据倾斜
// MapReduce data skew
MR_DATA_SKEW("mrDataSkew", "MR数据倾斜", "runPerformance"),

// MapReduce Task长尾
// MapReduce Task long tail
MR_TASK_DURATION("mrTaskDurationAbnormal", "MRTask长尾", "runPerformance"),

// MapReduce推测执行Task过多
// MapReduce speculative task is too many
MR_SPECULATIVE_TASK("mrSpeculativeTask", "MR推测执行Task过多", "runPerformance"),

// MapReduce GC异常
// MapReduce GC exception
MR_GC_ABNORMAL("mrGCAbnormal", "MRGC异常", "runPerformance"),

// 其他异常
// other exception
OTHER_EXCEPTION("otherException", "其他异常", "runError");

private final String category;
Expand Down Expand Up @@ -120,7 +120,7 @@ public String getCategory() {
}

/**
* 获取app异常类型,按enum顺序获取其中文列表
* Get the exception type of the app and get the Chinese list in the order of the enum
*
* @param categoryList
* @return
Expand All @@ -139,7 +139,7 @@ public static List<String> getAppCategoryCh(List<String> categoryList) {
}

/**
* 获取app异常类型,按enum顺序获取其英文列表
* Get the exception type of the app and get the English list in the order of the enum.
*
* @param categoryChList
* @return
Expand All @@ -158,7 +158,7 @@ public static List<String> getAppCategoryEn(List<String> categoryChList) {
}

/**
* 获取app异常类型的中文列表
* Get the list of app exception types.
*
* @return
*/
Expand All @@ -171,7 +171,7 @@ public static List<String> getAllAppCategoryOfChina() {
}

/**
* 获取app异常类型的中文名称
* Get the Chinese name of app exception types.
*/
@Deprecated
public static String getAppCategoryOfChina(String category) {
Expand All @@ -184,7 +184,7 @@ public static String getAppCategoryOfChina(String category) {
}

/**
* 获取app异常类型的desc
* Get the description of app exception types.
*/
public static String getAppCategoryOfDesc(String category) {
if (MAP.containsKey(category)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@
public class Constant {

/**
* 小时毫秒数值
* The value of milliseconds in an hour.
*/
public static final long HOUR_MS = 60 * 60 * 1000;
/**
* 天秒数值
* The value in seconds of Tian (a unit of time in Chinese mythology)
*/
public static final long DAY_SECONDS = 24 * 60 * 60;
/**
* spark event log路径
* Spark event log path.
*/
public static final String SPARK_EVENT_LOG_DIRECTORY = "spark:event:log:directory:";
/**
* spark历史服务器缓存key
* Spark history server cache key.
*/
public static final String SPARK_HISTORY_SERVERS = "spark:history:servers";

/**
* yarn集群缓存key
* Yarn cluster cache key
*/
public static final String YARN_CLUSTERS = "yarn:clusters";
/**
* resourceManager对应jobHistoryServer
* ResourceManager corresponds to JobHistoryServer.
*/
public static final String RM_JHS_MAP = "rm:jhs:map";
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
import java.util.concurrent.ConcurrentHashMap;

/**
* 异常类型枚举类
* Exception type enumeration class.
*/
public enum JobCategoryEnum {

/**
* 运行失败
* Failed to run.
*/
executionFailed("运行失败", "执行失败的任务"),

Expand Down Expand Up @@ -70,7 +70,7 @@ public String getMsg() {


/**
* 获取作业异常类型的中文列表
* Get the Chinese list of job exception types.
* @return
*/
public static List<String> getAllAppCategoryOfChina() {
Expand All @@ -82,7 +82,7 @@ public static List<String> getAllAppCategoryOfChina() {
}

/**
* 获取作业异常类型,按enum顺序获取其中文列表
* Get the job exception type and get the Chinese list in the order of the enum.
*
* @param categoryList
* @return
Expand All @@ -101,7 +101,7 @@ public static List<String> getJobCategoryCh(List<String> categoryList) {
}

/**
* 获取作业异常类型,按enum顺序获取其英文列表
* Get the job exception type and get the English list in the order of the enum.
*
* @param categoryChList
* @return
Expand All @@ -120,7 +120,7 @@ public static List<String> getJobCategoryEn(List<String> categoryChList) {
}

/**
* 获取作业异常类型的msg
* Get the message of job exception types.
*/
public static String getJobNameMsg(String category) {
if (MAP.containsKey(category)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
package com.oppo.cloud.common.constant;

/**
* 任务状态枚举类型
* Task status enumeration type
*/
public enum TaskStateEnum {

/**
* 任务状态
* Task status
*/
success("成功"),
fail("失败");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@Getter
public enum YarnAppType {
/**
* 任务状态
* Yarn Application Type
*/
SPARK(0, "Apache Spark"),
FLINK(1, "Apache Flink");
Expand Down
Loading

0 comments on commit eed3468

Please sign in to comment.