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

add usePrunedSchema plugin #2157

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

add usePrunedSchema plugin #2157

wants to merge 2 commits into from

Conversation

EmrysMyrddin
Copy link
Collaborator

Description

Adds a plugin to automatically clean up the schema by applying pruneSchema from @graphql-tools/utils.

Type of change

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

Copy link

changeset-bot bot commented Feb 19, 2024

⚠️ No Changeset found

Latest commit: 8cec5a2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@EmrysMyrddin EmrysMyrddin force-pushed the feat/use-pruned-schema branch from f64c46e to f94691d Compare February 19, 2024 13:06
Copy link
Contributor

💻 Website Preview

The latest changes are available as preview in: https://57d381bd.envelop.pages.dev

@theguild-bot
Copy link
Collaborator

✅ Benchmark Results

     ✓ no_errors
     ✓ expected_result

     checks.............................................: 100.00% ✓ 839606     ✗ 0     
     data_received......................................: 3.2 GB  27 MB/s
     data_sent..........................................: 183 MB  1.5 MB/s
     envelop_total......................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     event_loop_lag.....................................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-and-no-internal-tracing }...: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-cache-jit }.......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:envelop-just-cache }......................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     ✓ { mode:graphql-js }..............................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     http_req_blocked...................................: avg=1.94µs  min=701ns    med=1.7µs   max=5.3ms   p(90)=2.3µs   p(95)=2.6µs  
     http_req_connecting................................: avg=23ns    min=0s       med=0s      max=1.27ms  p(90)=0s      p(95)=0s     
     http_req_duration..................................: avg=2.56ms  min=147.45µs med=2.21ms  max=80.74ms p(90)=4.64ms  p(95)=5.18ms 
       { expected_response:true }.......................: avg=2.56ms  min=147.45µs med=2.21ms  max=80.74ms p(90)=4.64ms  p(95)=5.18ms 
     ✓ { mode:envelop-cache-and-no-internal-tracing }...: avg=2.71ms  min=366.95µs med=2.35ms  max=17.8ms  p(90)=4.64ms  p(95)=5.04ms 
     ✓ { mode:envelop-cache-jit }.......................: avg=1.52ms  min=147.45µs med=1.19ms  max=15.24ms p(90)=2.46ms  p(95)=2.64ms 
     ✓ { mode:envelop-just-cache }......................: avg=2.72ms  min=398.62µs med=2.34ms  max=36.36ms p(90)=4.64ms  p(95)=5.1ms  
     ✓ { mode:graphql-js }..............................: avg=5.07ms  min=540.84µs med=4.28ms  max=80.74ms p(90)=8.52ms  p(95)=9.3ms  
     http_req_failed....................................: 0.00%   ✓ 0          ✗ 419803
     http_req_receiving.................................: avg=34.84µs min=11.46µs  med=27.67µs max=14.83ms p(90)=41.99µs p(95)=46.51µs
     http_req_sending...................................: avg=12.14µs min=4.68µs   med=9.85µs  max=10.06ms p(90)=14.21µs p(95)=18.33µs
     http_req_tls_handshaking...........................: avg=0s      min=0s       med=0s      max=0s      p(90)=0s      p(95)=0s     
     http_req_waiting...................................: avg=2.51ms  min=121.4µs  med=2.16ms  max=80.64ms p(90)=4.59ms  p(95)=5.12ms 
     http_reqs..........................................: 419803  3498.17913/s
     iteration_duration.................................: avg=2.85ms  min=359.26µs med=2.47ms  max=81.32ms p(90)=4.94ms  p(95)=5.54ms 
     iterations.........................................: 419803  3498.17913/s
     vus................................................: 10      min=10       max=10  
     vus_max............................................: 20      min=20       max=20  

Copy link
Collaborator

@saihaj saihaj left a comment

Choose a reason for hiding this comment

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

why would we want to do this on runtime, why not have a pruned schema at build time before the server even starts? This way the pruned schema is also part of the schema registry?

@EmrysMyrddin
Copy link
Collaborator Author

This is probably for when you are not fully in control of the schema you are exposing, like federating multiple schemas from other teams in your company :-)

But If you think this is not useful I can close it. I'm not that much convinced of the utility of this, it should perhaps better be applied on schema loading. But this has the good aspect of being very simple to add to an existing setup. Just put the plugin and the schema is cleaned up.

Copy link
Collaborator

@saihaj saihaj left a comment

Choose a reason for hiding this comment

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

I see what you mean. I see how it can be easy to integrate

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.

3 participants