Skip to content

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

Merged
merged 7 commits into from
Jul 31, 2025
Merged

Profiler tweaks for JSON serialisation #4068

merged 7 commits into from
Jul 31, 2025

Conversation

dondonz
Copy link
Member

@dondonz dondonz commented Jul 30, 2025

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 JSON

Also changing some formatted strings into map values that's easier to parse and analyse later

Copy link
Contributor

github-actions bot commented Jul 30, 2025

Test Results

  322 files    322 suites   3m 24s ⏱️
5 003 tests 4 997 ✅ 6 💤 0 ❌
5 092 runs  5 086 ✅ 6 💤 0 ❌

Results for commit 0f22f07.

♻️ This comment has been updated with latest results.

@dondonz dondonz changed the title WIP Profiler tweaks Profiler tweaks for JSON serialisation Jul 31, 2025
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)");
Copy link
Member Author

@dondonz dondonz Jul 31, 2025

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

Copy link
Member

@andimarek andimarek left a 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);
Copy link
Member

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);
Copy link
Member

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"?

Copy link
Member Author

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.

Copy link
Member Author

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()
Copy link
Member Author

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"
Copy link
Member Author

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());
Copy link
Member Author

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

@dondonz dondonz merged commit d61c53a into master Jul 31, 2025
2 checks passed
@dondonz dondonz added this to the 25.x breaking changes milestone Aug 2, 2025
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 this pull request may close these issues.

3 participants