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 utility to fetch managed federation supergraph #6223

Merged
merged 18 commits into from
Jun 4, 2024

Conversation

EmrysMyrddin
Copy link
Collaborator

@EmrysMyrddin EmrysMyrddin commented May 30, 2024

Description

This PR implement a fetcher to build a stitched schema from GraphOS managed federation.

fixes #6226

Type of change

  • New feature (non-breaking change which adds functionality)

Copy link

changeset-bot bot commented May 30, 2024

🦋 Changeset detected

Latest commit: 7e6b24e

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

This PR includes changesets to release 2 packages
Name Type
@graphql-tools/federation Patch
federation-benchmark 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 May 30, 2024

✅ Benchmark Results

     ✓ no_errors
     ✓ expected_result

     checks.........................: 100.00% ✓ 342       ✗ 0  
     data_received..................: 40 MB   4.0 MB/s
     data_sent......................: 146 kB  15 kB/s
     http_req_blocked...............: avg=3.89µs   min=2.09µs   med=2.57µs  max=172.07µs p(90)=3.81µs   p(95)=3.99µs  
     http_req_connecting............: avg=676ns    min=0s       med=0s      max=115.7µs  p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=54.33ms  min=47.23ms  med=50.36ms max=145.16ms p(90)=57.07ms  p(95)=84.62ms 
       { expected_response:true }...: avg=54.33ms  min=47.23ms  med=50.36ms max=145.16ms p(90)=57.07ms  p(95)=84.62ms 
     http_req_failed................: 0.00%   ✓ 0         ✗ 171
     http_req_receiving.............: avg=136.35µs min=104.02µs med=129.4µs max=683.04µs p(90)=146.77µs p(95)=155.52µs
     http_req_sending...............: avg=26.05µs  min=16.53µs  med=25.26µs max=101.05µs p(90)=30.18µs  p(95)=34.95µs 
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s      max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=54.17ms  min=47.07ms  med=50.2ms  max=144.41ms p(90)=56.89ms  p(95)=84.47ms 
     http_reqs......................: 171     17.096566/s
     iteration_duration.............: avg=58.47ms  min=50.83ms  med=54.42ms max=149.14ms p(90)=62.93ms  p(95)=88.7ms  
     iterations.....................: 171     17.096566/s
     vus............................: 1       min=1       max=1
     vus_max........................: 1       min=1       max=1

Copy link
Contributor

github-actions bot commented May 30, 2024

💻 Website Preview

The latest changes are available as preview in: https://6d598355.graphql-tools.pages.dev

@EmrysMyrddin EmrysMyrddin requested a review from ardatan May 30, 2024 18:59
Copy link
Contributor

github-actions bot commented May 30, 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-tools/federation 1.1.37-alpha-20240604080225-7e6b24e313ccf7c34d5814aee98d58a244c2e129 npm ↗︎ unpkg ↗︎

@ardatan ardatan force-pushed the managed-federation-fetcher branch from a357311 to bdd5c9c Compare May 30, 2024 21:42
};

export class SupergraphSchemaManager {
Copy link
Owner

Choose a reason for hiding this comment

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

Just an idea... This can be an event target and it can emit events such as schema, error, message etc instead of onSchemaChange, onFailure and logger.

Copy link
Owner

Choose a reason for hiding this comment

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

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 tried to do it. I really dislike the API of dotansimha/graphql-yoga@main/packages/event-target/typed-event-target/src/index.ts. It's tight to DOM usage which make it much less clear how to use it.

I've tried a implementation based on EventEmitter which works pretty great, but it's then tight to Node, which means it would make this work only in Node environment, or I have to make a cross-plateform polyfill for it.

@ardatan ardatan merged commit db29280 into master Jun 4, 2024
30 checks passed
@ardatan ardatan deleted the managed-federation-fetcher branch June 4, 2024 09:43
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.

New feature: fetch Apollo Managed Federation supergraph from GraphOS
2 participants