Skip to content

Instrument usage of ExecutableNormalizedOperationFactory.createExecutableNormalizedOperation #4045

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

timward60
Copy link
Contributor

@timward60 timward60 commented Jul 9, 2025

Our usage of GraphQL Java depengs on selection sets which currently backed by executable normalized operations. This PR adds instrumentation that can be used to measure the computation of this component. This is the part 1/3 to support caching of executable normalized operations.

@timward60 timward60 force-pushed the timward-instrument-eno branch from 74e7ed3 to 9553a10 Compare July 9, 2025 06:17
@timward60 timward60 force-pushed the timward-instrument-eno branch from 9553a10 to d0b2634 Compare July 9, 2025 06:40
@timward60 timward60 marked this pull request as ready for review July 9, 2025 07:07
@timward60 timward60 force-pushed the timward-instrument-eno branch from f36ea22 to 8a4c715 Compare July 9, 2025 08:47
@timward60 timward60 force-pushed the timward-instrument-eno branch from 8a4c715 to 6ac9b17 Compare July 9, 2025 08:57
@@ -23,7 +23,7 @@
* An operation consists of a list of {@link ExecutableNormalizedField}s in a parent child hierarchy
*/
@PublicApi
public class ExecutableNormalizedOperation {
public class ExecutableNormalizedOperation implements ParsedNormalizedOperation {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh you are going for a common interface - again I dont think its "parsed" - this is not parsing - parsing has a very specific name in this code base - eg text -> AST elements

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this bit I expected some discussion. Possibly I should rename the new normalized operation implementation classes to something else then use NormalizedOperation as the interface name, otherwise if there is a better interface name then we can change to that. Let me know what you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference here is the follow up PR (WIP) to enable a config to switch between ExecutableNormalizedOperation and NormalizedOperation. #4047

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh didnt see your replies when I made more naming suggestions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name storming

NormalizedOperation + ExecutableNormalizedOperation

What is the common name here?

NormalOperation
GraphQlOperation
GraphQlNormalizedOperation

Leaning towards GraphQlNormalizedOperation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bbakerman and I had a chat and thinking more about it I am not 100% sure we really want an interface and two different implementations.

Not only the naming makes it clear that this is very hard to distinguish ... maybe we really want to have just NormalizedField which is a combination of ENF and the current NF.

Copy link
Contributor Author

@timward60 timward60 Jul 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I will still need an interface internally to allow the switching between ENO and NO for experimental usage, but can hide that.

Re the instrumentation do we want a separate method for executable normalized operation and normalized document creation, or should I just create a result container that can hold either types?

* to multiple object types.
*/
@PublicApi
public interface ParsedNormalizedOperation {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name is hard - but again I dont think this is Parsed - but I am not sure on a name - but I cant help shaking the feeling its not parsed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name storming

NormalizedOperation + ExecutableNormalizedOperation

What is the common name here?

  • NormalOperation
  • GraphQlOperation
  • GraphQlNormalizedOperation

@timward60 timward60 force-pushed the timward-instrument-eno branch from 9da637b to 61400e6 Compare July 10, 2025 02:51
Copy link
Member

@bbakerman bbakerman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ovarall happy with this PR except for naming. We need to get the naming right now

@timward60
Copy link
Contributor Author

I am ovarall happy with this PR except for naming. We need to get the naming right now

I applied one of the suggested names. Let me know if folks prefer something else.

@timward60 timward60 requested a review from bbakerman July 11, 2025 02:25
@timward60 timward60 requested a review from andimarek July 16, 2025 04:59
@timward60
Copy link
Contributor Author

timward60 commented Jul 16, 2025

@bbakerman, @andimarek: I have updated the PR to make the new instrumentation specific, as well as annotating it with @ExperimentalApi now to avoid consumers taking a hard dependency on it.

@andimarek
Copy link
Member

andimarek commented Jul 16, 2025

@timward60 just to make you aware: we are adding a profiler: #3976 This will be merged very soon. Maybe if the only goal of the instrumentation is to measure peformance we should consider using Profiler. What do you think?

@timward60
Copy link
Contributor Author

timward60 commented Jul 16, 2025

@timward60 just to make you aware: we are adding a profiler: #3976 This will be merged very soon. Maybe if the only goal of the instrumentation is to measure peformance we should consider using Profiler. What do you think?

I see, let me take a look at that proposal/implementation and get back to you. In general we use the instrumentation callbacks for profiling in many places e.g. logs, open telemetry tracing, metrics (we have various internal systems for different diagnostic aspects). I would need to see if it would still align and that we could still expose it those various consumers.

If there is some reluctance in the meantime, I will hold off on this PR until I have time to get back to you on if I foresee any issues with the profiler proposal from our usage above. In the meantime we will continue to use our internal fork to collect some data. Main reason behind this is to measure the move from ExecutableNormalizedOperations to NormalizedDocuments (with caching support). Once I add some test coverage to the draft PR (#4048), I will publish it for review.

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