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

MetricNode#toFatString 时间转换影响性能 #3463

Open
brucelwl opened this issue Oct 27, 2024 · 4 comments · May be fixed by #3466
Open

MetricNode#toFatString 时间转换影响性能 #3463

brucelwl opened this issue Oct 27, 2024 · 4 comments · May be fixed by #3466

Comments

@brucelwl
Copy link

public String toFatString() {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
StringBuilder sb = new StringBuilder(32);
sb.delete(0, sb.length());
sb.append(getTimestamp()).append("|");
sb.append(df.format(new Date(getTimestamp()))).append("|");
String legalName = getResource().replaceAll("\\|", "_");
sb.append(legalName).append("|");
sb.append(getPassQps()).append("|");
sb.append(getBlockQps()).append("|");
sb.append(getSuccessQps()).append("|");
sb.append(getExceptionQps()).append("|");
sb.append(getRt()).append("|");
sb.append(getOccupiedPassQps()).append("|");
sb.append(concurrency).append("|");
sb.append(classification);
sb.append('\n');
return sb.toString();

214行, 每次都创建新的SimpleDateFormat影响性能, 改成java8的时间吧

@manojks1999 manojks1999 linked a pull request Oct 27, 2024 that will close this issue
@manojks1999
Copy link

@brucelwl , I have made a PR please check this and let me know if any changes.

Thanks

@brucelwl
Copy link
Author

@manojks1999 评论了,你看下

@manojks1999
Copy link

@brucelwl I could not see any comment in PR and even in code too.

@brucelwl
Copy link
Author

@manojks1999 现在再看下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants