支持“核心”参数
打包逻辑优化
Showing
| ... | ... | @@ -49,8 +49,8 @@ import java.util.Map; |
| * @author: wanghaiying (<a href="wanghaiying@zorkdata.com.cn">wanghaiying@zorkdata.com.cn</a>) | ||
| * Date: Create in 2020/9/23 9:30 | ||
| */ | ||
| public class HadoopMask { | ||
| private static final Logger logger = LoggerFactory.getLogger(HadoopMask.class); | ||
| public class HdfsLogMaskUtil { | ||
|
||
| private static final Logger logger = LoggerFactory.getLogger(HdfsLogMaskUtil.class); | ||
|
||
| /** | ||
| * hdfs日志文件脱敏 | ||
| ... | ... | @@ -73,6 +73,8 @@ public class HadoopMask { |
| ArrayList< String> fieldsWhiteList = new ArrayList<String>(fieldsWhiteListArray.length); | ||
| Collections.addAll(fieldsWhiteList, fieldsWhiteListArray); | ||
| String core = String.valueOf(conf.get(ParamConstants.CORE)).trim(); | ||
| List<String> logFiles = filterHdfsLogFiles(hdfsLogQueryParam.getHdfsSrc(), hdfsLogQueryParam.getDate(), | ||
| hdfsLogQueryParam.getStartTime(), hdfsLogQueryParam.getEndTime()); | ||
| ... | ... | @@ -96,7 +98,7 @@ public class HadoopMask { |
| new TypeReference<LogData>() { | ||
| }); | ||
| //根据日志事件的核心信息做过滤 | ||
| if (null != hdfsLogQueryParam.getCore() && logData.getDimensions().get("hostname").indexOf("c9") > -1 ) { | ||
| if (null != hdfsLogQueryParam.getCore() && logData.getDimensions().get("hostname").indexOf(core) > -1 ) { | ||
| //根据日志事件的timestamp做过滤 | ||
| Long timestamp = DateUtils.utc2timestamp(logData.getTimestamp()); | ||
| boolean flag = null != timestamp && timestamp > hdfsLogQueryParam.getStartTime() | ||
| ... | ... | |
| ... | ... | @@ -21,7 +21,7 @@ import java.util.Properties; |
| * @Email xiesen310@163.com | ||
| * @Date 2020/10/21 14:51 | ||
| */ | ||
| public class KafkaMask { | ||
| public class KafkaMsgMaskUtil { | ||
|
||
| /** | ||
| * kafka消息数据脱敏 | ||
| * | ||
| ... | ... | |
-
SonarQube analysis reported 149 issues
-
🚫 19 critical -
⚠ 80 major -
🔽 49 minor -
ℹ 1 info
Watch the comments in this conversation to review them.
Top 30 extra issues
Note: The following issues were found on lines that were not modified in the commit. Because these issues can't be reported as line comments, they are summarized here:
-
🚫 Move constants to a class or enum.📘 -
🚫 Move constants to a class or enum.📘 -
🚫 Move constants to a class or enum.📘 -
🚫 Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.📘 -
🚫 Change this "try" to a try-with-resources. (sonar.java.source not set. Assuming 7 or greater.)📘 -
🚫 Refactor this code to not throw exceptions in finally blocks.📘 -
🚫 Refactor this code to not throw exceptions in finally blocks.📘 -
🚫 Make "patterns" private or transient.📘 -
🚫 Define a constant instead of duplicating this literal "序列化失败" 15 times.📘 -
🚫 Define a constant instead of duplicating this literal " {\n" 7 times.📘 -
🚫 [Define a constant instead of duplicating this literal " "type": \n" 7 times.📘 -
🚫 Define a constant instead of duplicating this literal " "string",\n" 4 times.📘 -
🚫 Define a constant instead of duplicating this literal " "null"\n" 4 times.📘 -
🚫 [Define a constant instead of duplicating this literal " ]\n" 7 times.](https://git.zorkdata.com/xiesen/transactionlogmask/blob/eff193d302b69f0a01f80ff39d793752de2c4d4b/src/main/java/com/zorkdata/datamask/util/avro/LogAvroMacroDef.java#L20)📘 -
🚫 Define a constant instead of duplicating this literal " },\n" 6 times.📘 -
🚫 Define a constant instead of duplicating this literal " "null",\n" 3 times.📘 -
🚫 Define a constant instead of duplicating this literal " {\n" 3 times.📘 -
🚫 Define a constant instead of duplicating this literal " "type": "map",\n" 3 times.📘 -
🚫 Define a constant instead of duplicating this literal " }\n" 3 times.📘 -
⚠ Define and throw a dedicated exception instead of using a generic one.📘 -
⚠ Remove this unused "source" private field.📘 -
⚠ Remove this unused "hdfsSrc" private field.📘 -
⚠ Remove this unused "hdfsDest" private field.📘 -
⚠ Remove this unused "core" private field.📘 -
⚠ Remove this unused "date" private field.📘 -
⚠ Remove this unused "startTime" private field.📘 -
⚠ Remove this unused "endTime" private field.📘 -
⚠ Remove this unused "servers" private field.📘 -
⚠ Remove this unused "zookeeper" private field.📘 -
⚠ Remove this unused "topic" private field.📘
- ... 116 more
-