-
Notifications
You must be signed in to change notification settings - Fork 10
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
Missing instrumentation for graphql-ruby lazy resolve #5
Comments
@joshjcarrier hey, thanks for opening the issue! The support for introspecting
That's a good question. I'm not sure, but probably something like:
In total:
In Apollo Engine (might be a little bit tricky to implement):
But ideally should be (where "x" is an idle state):
Will ask people from Apollo whether they're planning to support such representation in the future. Please let me know what you think. |
I like the idea of all lazies spanning a batched request. I think the granularity could be improved to be useful for unequal costs of lazy resolution, but that's deeper than just the execution time of an unfulfilled promise. Some ways to interpret that sample trace: Case 1: each user costs the same timeCases: Optimized DB query Expected timelineUser1, 2 or 3 is adding to the cost of the query
Actual timelinePretty close if you ignore the 2ms underestimations; knowing how the lazy resolver was implemented.
Case 2: each user costs different timeCases: HTTP parallelization, chunking batches Expected timelineUser2 is adding significant cost to the query
Actual timelineThe significant cost could have come from querying any of the users.
The challenge will be how to bubble this information up, if Apollo Engine is meant to tell us the true cost of each piece of data. |
@joshjcarrier thanks a lot for your comment! I contacted Apollo team, they currently don't support the "idle" state (so, people won't see the actual picture in the interface) but they may implement it in the future since there are a lot of questions and it's not so clear what is happening during the timeframe. I think that for now, we'll implement the simplest trace:
While in reality it should look like:
|
Thanks a lot for following up! Wondering if it it's valuable to override measurements with something from my resolver, since its all accessible in resolve ->(obj, args, ctx) {
MyLoader.for(ctx).load(..).then do |result|
# need the context for the current resolver
# opens up future for tagging traces and other metadata for Apollo Engine UI?
ctx['apollo-tracing']['resolvers'][??]['duration'] = result.my_custom_duration
end
} Then it could be customized to look like:
|
Yeah, potentially you could override the values but I'd consider accessing the data in the context as private :) I'd pause the work on this issue for now until Apollo Engine supports showing the idle time per field in case of batching. |
Wondering how this might be supported, especially when paired with shopify/graphql-batch, as the cost of many fields are aggregated together with DataLoader
The text was updated successfully, but these errors were encountered: