-
Notifications
You must be signed in to change notification settings - Fork 276
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
count persisted cache hits #1117
Conversation
✅ Deploy Preview for apollo-router-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
This comment has been minimized.
This comment has been minimized.
@glasser could you provide some context on how In the protobuf schema, I also see the // Was this query specified successfully as a persisted query hash?
bool persisted_query_hit = 21;
// Did this query contain both a full query string and a persisted query hash?
// (This typically means that a previous request was rejected as an unknown
// persisted query.)
bool persisted_query_register = 22; Is it counted separately from the |
@Geal persisted_query_register in Trace matches persisted_query_misses in aggregated stats and is a better name for the same thing. Perhaps we should rename the aggregated field to match the trace field. Looks from monorepo
So yeah, don't actually count "misses", count "registers" since those typically come right after a miss. Does that make sense? Note that Apollo Server doesn't have a way of reporting persisted query not-found or not-supported errors (or like "no |
(FWIW, while implementing this is a good idea for feature-parity's sake, I don't believe Studio actually shows this data anywhere. In fact I don't think it writes the aggregated data anywhere and it probably does save the Trace flags along with the Trace but doesn't expose it via the API, let alone show it in the UI.) |
ok, so then I'll record query registers in |
this matches the behaviour in Apollo Server
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.
LGTM. Needs a changelog entry.
Fix #1014
This counts properly
persisted_cache_hits
, but notpersisted_cache_misses
. Apparently, in that case we do not even get into theupdate_apollo_metrics
function, so I suspect the error returned by APQ skips the reporting phase. I also do not know yet under whichstats_report_key
I should record APQ cache misses, because if we get a cache miss, we do not know which query it was linked to.Looking at this code it's not clear to me which stats report key I should use: https://github.com/apollographql/apollo-server/blob/main/packages/apollo-server-core/src/plugin/usageReporting/plugin.ts#L644-L682