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

[federation] add tests + handle failure + handle logs #3328

Merged
merged 7 commits into from
Jun 18, 2024

Conversation

EmrysMyrddin
Copy link
Collaborator

No description provided.

Copy link

changeset-bot bot commented Jun 17, 2024

🦋 Changeset detected

Latest commit: 9d1b732

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@graphql-yoga/apollo-managed-federation Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Jun 17, 2024

Apollo Federation Subgraph Compatibility Results

Federation 1 Support Federation 2 Support
_service🟢
@key (single)🟢
@key (multi)🟢
@key (composite)🟢
repeatable @key🟢
@requires🟢
@provides🟢
federated tracing🟢
@link🟢
@shareable🟢
@tag🟢
@override🟢
@inaccessible🟢
@composeDirective🟢
@interfaceObject🟢

Learn more:

Copy link
Contributor

github-actions bot commented Jun 17, 2024

✅ Benchmark Results

     ✓ no_errors{mode:graphql}
     ✓ expected_result{mode:graphql}
     ✓ no_errors{mode:graphql-jit}
     ✓ expected_result{mode:graphql-jit}
     ✓ no_errors{mode:graphql-response-cache}
     ✓ expected_result{mode:graphql-response-cache}
     ✓ no_errors{mode:graphql-no-parse-validate-cache}
     ✓ expected_result{mode:graphql-no-parse-validate-cache}

     checks.......................................: 100.00% ✓ 425124      ✗ 0     
     data_received................................: 1.7 GB  14 MB/s
     data_sent....................................: 86 MB   716 kB/s
     http_req_blocked.............................: avg=1.4µs    min=962ns    med=1.26µs   max=242.75µs p(90)=1.82µs   p(95)=2.03µs  
     http_req_connecting..........................: avg=2ns      min=0s       med=0s       max=135.71µs p(90)=0s       p(95)=0s      
     http_req_duration............................: avg=355.36µs min=209.68µs med=319.79µs max=23.83ms  p(90)=458.18µs p(95)=477.49µs
       { expected_response:true }.................: avg=355.36µs min=209.68µs med=319.79µs max=23.83ms  p(90)=458.18µs p(95)=477.49µs
     ✓ { mode:graphql-jit }.......................: avg=279.3µs  min=209.68µs med=258µs    max=18.45ms  p(90)=288.09µs p(95)=299.77µs
     ✓ { mode:graphql-no-parse-validate-cache }...: avg=479.41µs min=397.95µs med=454.64µs max=9.55ms   p(90)=493.76µs p(95)=516.99µs
     ✓ { mode:graphql-response-cache }............: avg=338.34µs min=266.48µs med=319.43µs max=7.67ms   p(90)=351.5µs  p(95)=362.53µs
     ✓ { mode:graphql }...........................: avg=360.1µs  min=269.08µs med=327.8µs  max=23.83ms  p(90)=371.18µs p(95)=406.54µs
     http_req_failed..............................: 0.00%   ✓ 0           ✗ 212562
     http_req_receiving...........................: avg=33.27µs  min=15.73µs  med=33.21µs  max=8.34ms   p(90)=38.42µs  p(95)=40.56µs 
     http_req_sending.............................: avg=7.98µs   min=6.06µs   med=7.13µs   max=465.15µs p(90)=10.58µs  p(95)=11.24µs 
     http_req_tls_handshaking.....................: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting.............................: avg=314.1µs  min=178.32µs med=279.1µs  max=23.71ms  p(90)=416.73µs p(95)=433.89µs
     http_reqs....................................: 212562  1771.327387/s
     iteration_duration...........................: avg=559.86µs min=380.56µs med=520.69µs max=24.42ms  p(90)=666.5µs  p(95)=690.91µs
     iterations...................................: 212562  1771.327387/s
     vus..........................................: 1       min=1         max=1   
     vus_max......................................: 2       min=2         max=2   

Copy link
Contributor

github-actions bot commented Jun 17, 2024

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-yoga/apollo-link 3.4.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/urql-exchange 3.4.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/redis-event-target 3.0.1-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/graphiql 4.3.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
graphql-yoga 5.4.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/nestjs 3.4.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/nestjs-federation 3.4.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-apollo-inline-trace 3.4.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/apollo-managed-federation 0.1.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-apq 3.4.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-csrf-prevention 3.4.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-defer-stream 3.4.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-disable-introspection 2.4.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-graphql-sse 3.4.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-jwt 2.4.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-persisted-operations 3.4.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-prometheus 5.1.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-response-cache 3.6.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-sofa 3.4.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/render-graphiql 5.4.0-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎
@graphql-yoga/subscription 5.0.1-alpha-20240618085719-9d1b7321 npm ↗︎ unpkg ↗︎

Copy link
Contributor

github-actions bot commented Jun 17, 2024

💻 Website Preview

The latest changes are available as preview in: https://45a2c7e4.graphql-yoga.pages.dev

};

export function useManagedFederation(options: ManagedFederationPluginOptions = {}): Plugin {
const supergraphManager = new SupergraphSchemaManager(options);
const {
logger = console,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
logger = console,
logger = console,

You can get logger from Yoga instance passed in onYogaInit

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I've used the yoga logger, but i'm still using the console by default in case the manager is logging something before yoga is initialized.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can start the manager within onYogaInit maybe?🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I hesitated to move it there yes...
My goal was to make it start fetching as soon as possible, but if you think it's more important to be sure the yoga logger will be used, I can make the change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've made the change, I think it's better to avoid losing any logs (if an external logger is provided in place of the console) than saving potentially 2ms on a 100ms call :-P

@EmrysMyrddin EmrysMyrddin merged commit 9b468ec into main Jun 18, 2024
34 checks passed
@EmrysMyrddin EmrysMyrddin deleted the test-managed-federation branch June 18, 2024 09:02
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.

2 participants