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

transform trace-etl-service #516

Merged
merged 1 commit into from
Jul 4, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.List;

/**
* @Description 通过bootstrap工程BeanConfig初始化,以免不需要的工程启动报错
* @Description Initialize through the bootstrap project BeanConfig to avoid unwanted project startup errors
* @Author dingtao
* @Date 2022/4/18 3:31 下午
*/
Expand Down Expand Up @@ -70,10 +70,10 @@ public Result insertOrUpdate(HeraTraceEtlConfig config, String user) {
Date now = new Date();
int i = 0;
if (config.getId() == null) {
// 校验是否存在
// Check for existence
HeraTraceEtlConfig byBaseInfoId = heraTraceEtlConfigMapper.getByBaseInfoId(config.getBaseInfoId());
if(byBaseInfoId != null){
return Result.fail(GeneralCodes.InternalError, "项目配置已存在,请勿重复添加");
return Result.fail(GeneralCodes.InternalError, "The item configuration already exists. Do not add it again");
}
config.setCreateTime(now);
config.setUpdateTime(now);
Expand Down Expand Up @@ -102,7 +102,7 @@ public Result insertOrUpdate(HeraTraceEtlConfig config, String user) {
});
}
}
return i > 0 ? Result.success(null) : Result.fail(GeneralCodes.InternalError, "操作失败");
return i > 0 ? Result.success(null) : Result.fail(GeneralCodes.InternalError, "Operation failure");
}

public int delete(HeraTraceEtlConfig config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ public WriteEsService(EsTraceUtil esTraceUtil){
build();

public void insertJaegerService(String date, String serviceName, String oprationName) {
// 判断是否存在
// Determine whether there is
String key = serviceName + ":" + oprationName;
if (localCache.asMap().containsKey(key)) {
return;
} else {
// 插入es
// writer into ES
Map<String, String> map1 = new HashMap<>();
map1.put("serviceName", serviceName);
map1.put("operationName", oprationName);
Expand Down Expand Up @@ -201,7 +201,7 @@ public void insertDriver(DriverDomain driverDomain) {
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(driverDomain);
esTraceUtil.insertBulk(index, jsonObject);
} catch (Exception e) {
log.error("插入db/redis es数据异常:", e);
log.error("db/redis es data exception:", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static void submit(Runnable runnable){
try {
errorESthreadPoolExecutor.submit(runnable);
}catch(Exception e){
log.error("提交错误es任务失败:",e);
log.error("Failed to submit an error es task:",e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

public class MessageUtil {

// 消息体分隔符
// Message body separator
public static final String SPLIT = " ### ";
// rocksdb消息分隔符
// rocksdb message separator
public static final String ROCKS_SPLIT = " #### ";
public static final String ERROR_CODE = "ERROR";
// 各个字段的角标,方便修改
// Corner mark of each field for easy modification
public static final int START_TIME = 0;
public static final int DURATION = 1;
public static final int IP = 2;
Expand All @@ -20,11 +20,11 @@ public class MessageUtil {
public static final int EVENTS = 9;
public static final int REOUSCES = 10;
public static final int REFERERNCES = 11;
// 消息按分割之后的总数
// Messages by the total number after splitting
public static final int COUNT = 12;

// 用于缓存serviceName与operationName的redis key
// Cache the redis key for serviceName and operationName
public static final String TRACE_SERVICE_REDIS_KEY = "trace_service_";
// 缓存serviceName与operationName的redis key的过期时间
// Cache the expiration time of the redis key of serviceName and operationName
public static final int TRACE_SERVICE_REDIS_KEY_EXPIRE = 60 * 60 * 24;
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static TSpanData toTSpanData(String spanStr) {
message = spanStr.split(" \\| ")[1];
}
String[] messageArray = message.split(MessageUtil.SPLIT);
// 位数校验
// Bit check
if (messageArray.length != MessageUtil.COUNT) {
log.error("message count illegal : " + spanStr);
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ public void insertBulk(String index,String json){
JSONObject jsonObject = JSONObject.parseObject(json);
esProcessor.bulkInsert(index, jsonObject);
}catch (Exception e){
log.error("插入jaeger es数据异常:",e);
log.error("Insert jaeger es data exception:",e);
}
}

public void insertBulk(String index,Map jsonMap){
try {
esProcessor.bulkInsert(index, jsonMap);
}catch (Exception e){
log.error("插入jaeger es数据异常:",e);
log.error("Insert jaeger es data exception:",e);
}
}

Expand Down