-
Notifications
You must be signed in to change notification settings - Fork 508
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
Operation (Query) Metrics #1633
Conversation
|
} | ||
|
||
public void start() { | ||
startNanoTime = System.nanoTime(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from what i remember nano time is more expensive https://www.tutorialspoint.com/java-system-nanotime-vs-system-currenttimemillis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've found some good doc from JDK developer https://web.archive.org/web/20160308031939/https://blogs.oracle.com/dholmes/entry/inside_the_hotspot_vm_clocks
It explains why nanoTime() may be slow and what should be used for precise measurement.
Conclusion:
- nanoTime() may be slow in scale of microseconds
- nanoTime() may require hardware IO and that is why it may be slow
- nanoTime() is what recommended for elapsed time measurements.
- currentTimeMillis() is not so precise and may have a lag of 10ms
- we will use nanoTime() until we see a noticeable drop in performance.
private static final String INTERNAL_OPERATION_ID = "operationID"; | ||
|
||
private String startOperation() { | ||
String operationId = UUID.randomUUID().toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sending operationId also as query_id this can be a good connection between our code and the actual operation in ClickHouse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
Summary
Adds class to represent metrics of an operation.
Checklist
Delete items not relevant to your PR: