Skip to content
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

Fix APQ and introspection gauges #6012

Merged
merged 2 commits into from
Sep 17, 2024
Merged

Fix APQ and introspection gauges #6012

merged 2 commits into from
Sep 17, 2024

Conversation

BrynCooke
Copy link
Contributor

@BrynCooke BrynCooke commented Sep 17, 2024

Similar to the query planner gauges, these must be initialized after telemetry has been activated.

Fixes:

  • apollo_router_cache_size for APQ and introspection

As a result of this change every query planner in the query planner pool will share the same cache storage for introspection queries. Otherwise many identical gauges are created, and they are not summed. It doesn't really make sense that each query planner should have a separate cache anyway.

Another issue was noticed, and commented on. APQLayer uses deduplicating cache which is fallible. This is initialized after telemetry has been activated, so if it fails it is likely that telemetry will stop working. This is not fixable without a larger refactor to bring APQ init forward, which is out of scope for this PR. We'll tackle router lifecycle as a larger holistic refactor later.


Checklist

Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.

  • Changes are compatible1
  • Documentation2 completed
  • Performance impact assessed and acceptable
  • Tests added and passing3
    • Unit Tests
    • Integration Tests
    • Manual Tests

Exceptions

  • docs not needed because this is a bug fix.
  • Added to existing integration tests because this is telemetry.

Notes

Footnotes

  1. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this.

  2. Configuration is an important part of many changes. Where applicable please try to document configuration examples.

  3. Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

Sorry, something went wrong.

This comment has been minimized.

Similar to the query planner gauges, these must be initialized after telemetry has been activated.

Fixes:
* `apollo_router_cache_size` for `APQ` and `introspection`

As a result of this change every query planner in the query planner pool will share the same cache storage for introspection queries. Otherwise many identical gauges are created, and they are not summed. It doesn't really make sense that each query planner should have a separate cache anyway.

Another issue was noticed, and commented on. APQLayer uses deduplicating cache which is fallible. This is initialized after telemetry has been activated, so if it fails it is likely that telemetry will stop working. This is not fixable without a larger refactor to bring APQ init forward, which is out of scope for this PR. We'll tackle router lifecycle as a larger holistic refactor later.
@BrynCooke BrynCooke force-pushed the bryn/more-gauge-fixes branch from 7bf64b2 to e6da583 Compare September 17, 2024 10:52

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@BrynCooke BrynCooke requested review from Geal September 17, 2024 10:56
@BrynCooke BrynCooke marked this pull request as ready for review September 17, 2024 11:08
@BrynCooke BrynCooke requested review from a team as code owners September 17, 2024 11:08
@BrynCooke BrynCooke requested a review from bnjjj September 17, 2024 11:09
planner: Arc<Planner<QueryPlanResult>>,
capacity: NonZeroUsize,
cache: CacheStorage<String, Response>,
Copy link
Contributor

Choose a reason for hiding this comment

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

I see why we now need to pass the cache as an argument, but I feel it points to something wrong in the activate call. Instead of calling it directly everywhere, could the plugins register a closure to handles activation when they are created?

Copy link
Contributor Author

@BrynCooke BrynCooke Sep 17, 2024

Choose a reason for hiding this comment

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

I agree with the sentiment of this, but none of the query planner or APQ stuff are plugins, so they don't get to participate lifecycle. It's non-plugin code that needs to register a closure right now.

As a team we should discuss the lifecycle hooks and work towards refactoring both non-plugin and plugin code to use an agreed upon model.

As part of this we should also examine what we want in terms of hot reload functionality, as actually having any hot reload significantly complicates our codebase.

@BrynCooke BrynCooke merged commit bc554ce into dev Sep 17, 2024
13 checks passed
@BrynCooke BrynCooke deleted the bryn/more-gauge-fixes branch September 17, 2024 14:52
@abernix abernix mentioned this pull request Sep 24, 2024
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.

None yet

3 participants