-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Profiler tweaks for JSON serialisation #4068
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
Conversation
Test Results 322 files 322 suites 3m 24s ⏱️ Results for commit 0f22f07. ♻️ This comment has been updated with latest results. |
result.put("operation", operationType + ":" + operationName); | ||
result.put("startTime", startTime); | ||
result.put("endTime", endTime); | ||
result.put("totalRunTime", (endTime - startTime) + "(" + (endTime - startTime) / 1_000_000 + "ms)"); | ||
result.put("engineTotalRunningTime", engineTotalRunningTime + "(" + engineTotalRunningTime / 1_000_000 + "ms)"); |
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.
Change to nanoseconds only, if need be someone can convert to ms later
Remove string concatenation to make it easier to read
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.
See comments.
@@ -273,12 +273,12 @@ public List<String> getInstrumentationClasses() { | |||
|
|||
public Map<String, Object> shortSummaryMap() { | |||
Map<String, Object> result = new LinkedHashMap<>(); | |||
result.put("executionId", Assert.assertNotNull(executionId)); | |||
result.put("executionId", Assert.assertNotNull(executionId).toString()); | |||
result.put("operation", operationType + ":" + operationName); | |||
result.put("startTime", startTime); |
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.
actually we should suffix startTime and endTime also with Ns
to be clear here
@@ -273,12 +273,12 @@ public List<String> getInstrumentationClasses() { | |||
|
|||
public Map<String, Object> shortSummaryMap() { | |||
Map<String, Object> result = new LinkedHashMap<>(); | |||
result.put("executionId", Assert.assertNotNull(executionId)); | |||
result.put("executionId", Assert.assertNotNull(executionId).toString()); | |||
result.put("operation", operationType + ":" + operationName); |
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.
should that be two fields? operation Type and operation name? or one Map inside "operation"?
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.
Two fields are better, and better to be clearer on operation name vs type.
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 see what you meant, should they be nested or not
We've done both: nesting some information, but keeping all the timing information at the top level. I think operation name is one of the most important keys and I'd like to have that at the top level.
|
||
ExecutionInput ei = ExecutionInput.newExecutionInput() | ||
ExecutionInput ei = newExecutionInput() |
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 doesn't change anything, only IDE complaints
profilerResult.shortSummaryMap().get("dataFetcherResultTypes") == ["COMPLETABLE_FUTURE_COMPLETED" : ["count":2, "invocations":4], | ||
"COMPLETABLE_FUTURE_NOT_COMPLETED": ["count":2, "invocations":2], | ||
"MATERIALIZED" : ["count":2, "invocations":4]] | ||
profilerResult.shortSummaryMap().get("executionId") == "myExecutionId" |
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 is the only real test change
result.put("endTime", endTime); | ||
result.put("totalRunTime", (endTime - startTime) + "(" + (endTime - startTime) / 1_000_000 + "ms)"); | ||
result.put("engineTotalRunningTime", engineTotalRunningTime + "(" + engineTotalRunningTime / 1_000_000 + "ms)"); | ||
result.put("executionId", Assert.assertNotNull(executionId).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.
Cast to string to serialise in JSON logs
We're putting the finishing touches on the Profiler. We expect users will use the Profiler to sample logs and we're giving that a try ourselves.
ExecutionId
is better cast to a string for the output map, otherwise a logger can complain it doesn't know how to serialise this type to JSONAlso changing some formatted strings into map values that's easier to parse and analyse later