-
Notifications
You must be signed in to change notification settings - Fork 284
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
Add better context config for coprocessor to help migration #6752
Conversation
Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
✅ Docs preview readyThe preview is ready to be viewed. View the preview File Changes 0 new, 1 changed, 0 removed
Build ID: 737f6a158aa049d92b86fcd3 URL: https://www.apollographql.com/docs/deploy-preview/737f6a158aa049d92b86fcd3 |
@bnjjj, please consider creating a changeset entry in |
Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
👍🏻 to this idea — we added a connectors-specific config option to do something similar: https://github.com/apollographql/router/blob/dev/apollo-router/src/plugins/connectors/configuration.rs#L43 should we remove that option in favor of this approach? |
@lennyburdette good catch ! I think yes that would probably be enough to just include the context key in the coprocessor config. But for now the default config is to pass all context keys. Could it be an issue if your connector keys are passed by default ? |
we add the key only if you set that connectors-specific config value: https://github.com/apollographql/router/blob/dev/apollo-router/src/plugins/connectors/plugin.rs#L147-L175 ... we could switch this logic to read from your new config? |
I like this idea, but I would argue that a prerequisite would be for Apollo to supply a compendium/reference of all possible context keys in the Router documentation for your customers, so they know what context keys they can choose from. A list was added to the docs in docs/source/routing/customization/overview.mdx in this MR: https://github.com/apollographql/router/pull/6572/files#diff-e95018a62736abd100a39b77182d90ffa70565ec35cad5cb0cd366b1535f306a But then subsequent document updates seemed to have removed it. |
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.
General Comment:
I don't like having DEPRECATED const values scattered around the code base. I'd prefer if they were isolated to a single deprecated source file.
I have a question about the selective option. Does it only work with "new" names or can you use "deprecated" names? Also, is it possible to mix and match them within the same array? Would this lead to duplication and confusion?
Co-authored-by: Gary Pennington <gary@apollographql.com>
No it's only new names |
Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
…o bnjjj/feat_1011
Good catch @theJC I added back the docs for context keys you linked |
@lennyburdette if it's an opt-in option that's even better. I think you're right it should check the new configuration for context and add it if it's included in the context keys list |
@garypen I agree with you about the deprecated context keys. I think it's better to put everything into the same module/file. Can we just consider doing this in a follow up PR ? |
It could be done in a follow-up. |
We should document that clearly. |
Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
Is/should this also be available for Rhai scripts? |
@goto-bus-stop Yes but we will do this in a followup PR because it's taking more time. And I think it's also easier to spot in a rhai script when you're using a deprecated key |
Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
While focusing on optimizing the performance/efficiency of communicating with the coprocessor, can I please put a bug in your ear regarding looking into the possibility of adding Unix Domain socket support for communicating with coprocessor (#5739) Potentially better long term might be looking into the viability of refactoring/DRYing as much as possible of the httpclientservice used for outbound calls to subgraphs and the similar/duplicative work done for outbound calls for the coprocessor. That way advances/improvements/changes/observability there are available and leveraged for both pieces of communication (as well as hopefully sharing common configuration) Not having this consistent/common between these areas causes and will continue to cause additional efforts and asks from your customers to get them aligned as well as duplicative work for you. Several examples of efforts and asks to get coprocessor calling caught up with subgraph calling capabilities:
|
Context configuration
You can configure what you want to send from the context to your coprocessor. By default it's disabled (
false
) and doesn't send any context keys to the coprocessor. You now have the ability to give an arraycontaining all the context keys you want to send to your coprocessor. Sending only a selective list of context keys will increase the performances because it will lower the size of payloads between the router and coprocessor.
You can also set
context: deprecated
if you still want to use deprecated context key names from router 1.x. If you want to pass all context keys with new naming just setcontext: all
.Example:
Checklist
Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.
Exceptions
Note any exceptions here
Notes
Footnotes
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. ↩
Configuration is an important part of many changes. Where applicable please try to document configuration examples. ↩
Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions. ↩