-
Notifications
You must be signed in to change notification settings - Fork 90
feat: DH-19382: add server side timing to JsCommandResult #7145
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
feat: DH-19382: add server side timing to JsCommandResult #7145
Conversation
| message ExecuteCommandResponse { | ||
| string error_message = 1; | ||
| io.deephaven.proto.backplane.grpc.FieldsChangeUpdate changes = 2; | ||
| string start_timestamp = 3; |
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 would prefer to use actual nanos since the epoch than something that needs parsing/interpretation.
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.
Note, I realize that JS sucks at numbers; but the proto is a generic thing. Anytime we add a field, we should also add a comment for the protodocs.
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.
We already have wiring to handle int64 in a format we can get it to js - the following change will make it still be a string in the browser, but we can expose as a DateWrapper so that JS can truncate to number, format to string, or ask for it as a js Date:
| string start_timestamp = 3; | |
| int64 start_timestamp = 3 [jstype=JS_STRING]; |
In theory proto also has a well known date types, but i'd vote just stick to nanos like we do for logs etc
https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/timestamp.proto
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.
Modified types to the jstype and added a comment
...n/javascript/proto/dhinternal/io/deephaven_core/proto/console_pb/ExecuteCommandResponse.java
Show resolved
Hide resolved
| diff.setChanges(fieldChanges); | ||
| diff.setStartTimestamp(startTimestamp); | ||
| diff.setEndTimestamp(endTimestamp); | ||
|
|
||
| return diff.build(); |
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.
nothing at all wrong with this style, but can also be a builder style as before:
| diff.setChanges(fieldChanges); | |
| diff.setStartTimestamp(startTimestamp); | |
| diff.setEndTimestamp(endTimestamp); | |
| return diff.build(); | |
| return diff.setChanges(fieldChanges) | |
| .setStartTimestamp(startTimestamp) | |
| .setEndTimestamp(endTimestamp) | |
| .build(); |
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.
Modified back to builder style
| * @return long | ||
| */ | ||
| @JsProperty | ||
| public LongWrapper getStartTimestamp() { |
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.
Probably DateWrapper instead?
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.
Changed to DateWrapper
No docs changes detected for 63c9150 |
| // Time it took to run the command, in nanoseconds | ||
| int64 start_timestamp = 3 [jstype=JS_STRING]; | ||
| int64 end_timestamp = 4 [jstype=JS_STRING]; |
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.
This comment is incorrect; if you were providing a single duration field, the comment would make sense.
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.
Improved comment
| throw new UnsupportedOperationException( | ||
| "Unrecognized systemic option: " + systemicOption); | ||
| } | ||
| long endTimestamp = Clock.system().currentTimeNanos(); |
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.
Note: if you actually only care about the duration (and not the timestamps), the difference between java.lang.System.nanoTime() would be more appropriate than the difference between Clock.system().currentTimeNanos().
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.
Although we are ultimately interested in the duration on the UI, I think the timestamps are sufficient for us #7145 (comment)
| io.deephaven.proto.backplane.grpc.FieldsChangeUpdate changes = 2; | ||
|
|
||
| // Time it took to run the command, in nanoseconds | ||
| int64 start_timestamp = 3 [jstype=JS_STRING]; |
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'm a little sad when I see this; maybe Colin has more context, but we are still not able to use google.protobuf.Timestamp and/or google.protobuf.Duration?
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.
Colin suggested this in a previous comment: #7145 (comment)
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.
As per Colin's comment sticking with this jstype syntax, further discussion of protobuf types seems like a broader discussion beyond the scope of this ticket
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.
the jstype option and using one of the built in types are sort of unrelated - but yes, we can't (yet) use other semi "built-in" types.
| string error_message = 1; | ||
| io.deephaven.proto.backplane.grpc.FieldsChangeUpdate changes = 2; | ||
|
|
||
| // Start and end timestamps for command execution, in nanoseconds since the unix epoch. |
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.
This comment is documentation for the start_timestamp field, not a general code comment. As such, probably makes sense to document each field as appropriate (I don't actually know if there is a way to add a "general" comment that doesn't effect resulting protobuf documentation).
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.
Did not realize that, thanks, made it two comments
Server side PR for DH-19382
Adds server side timing to
JsCommandResultfor query execution timeTested in deephaven/web-client-ui#2526