dotansimha / graphql-yoga

🧘 Rewrite of a fully-featured GraphQL Server with focus on easy setup, performance & great developer experience. The core of Yoga implements WHATWG Fetch API and can run/deploy on any JS environment.
https://the-guild.dev/graphql/yoga-server
MIT License
8.21k stars 569 forks source link

[apollo-usage-report] New plugin: send usage traces to Apollo GraphOS #3331

Closed EmrysMyrddin closed 1 month ago

EmrysMyrddin commented 3 months ago

This PR implement a new plugin that instrument the GraphQL request processing pipeline and send the traces to Apollo GraphOS usage report endpoint.

TODO:

This is a very minimal implementation. Namely, it doesn't support:

changeset-bot[bot] commented 3 months ago

🦋 Changeset detected

Latest commit: d4c5410afa5501bfb718d0080c5cb40a594ad076

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

This PR includes changesets to release 24 packages | Name | Type | | ------------------------------------------ | ----- | | @graphql-yoga/plugin-apollo-inline-trace | Major | | graphql-yoga | Minor | | @graphql-yoga/plugin-sofa | Major | | @graphql-yoga/nestjs | Major | | @graphql-yoga/nestjs-federation | Patch | | @graphql-yoga/plugin-apollo-usage-report | Major | | @graphql-yoga/render-graphiql | Major | | @graphql-yoga/apollo-managed-federation | Major | | @graphql-yoga/plugin-apq | Major | | @graphql-yoga/plugin-csrf-prevention | Major | | @graphql-yoga/plugin-defer-stream | Major | | @graphql-yoga/plugin-disable-introspection | Major | | @graphql-yoga/plugin-graphql-sse | Major | | @graphql-yoga/plugin-jwt | Major | | @graphql-yoga/plugin-persisted-operations | Major | | @graphql-yoga/plugin-prometheus | Major | | @graphql-yoga/plugin-response-cache | Major | | apollo-federation-gateway-with-yoga | Patch | | apollo-subgraph-with-yoga | Patch | | graphql-lambda | Patch | | cloudflare-advanced | Patch | | cloudflare | Patch | | nextjs-app | Patch | | hello-world-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

github-actions[bot] commented 3 months ago

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:

github-actions[bot] commented 2 months ago

✅ 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% ✓ 418954      ✗ 0     
     data_received................................: 1.7 GB  14 MB/s
     data_sent....................................: 85 MB   705 kB/s
     http_req_blocked.............................: avg=1.48µs   min=971ns    med=1.3µs    max=7.23ms   p(90)=1.91µs   p(95)=2.11µs  
     http_req_connecting..........................: avg=2ns      min=0s       med=0s       max=145.48µs p(90)=0s       p(95)=0s      
     http_req_duration............................: avg=361.76µs min=221.53µs med=324.13µs max=14.94ms  p(90)=463.05µs p(95)=482.1µs 
       { expected_response:true }.................: avg=361.76µs min=221.53µs med=324.13µs max=14.94ms  p(90)=463.05µs p(95)=482.1µs 
     ✓ { mode:graphql-jit }.......................: avg=288.36µs min=221.53µs med=266.86µs max=14.94ms  p(90)=297.94µs p(95)=312.32µs
     ✓ { mode:graphql-no-parse-validate-cache }...: avg=486.28µs min=399.25µs med=458.86µs max=9.72ms   p(90)=498.75µs p(95)=532.04µs
     ✓ { mode:graphql-response-cache }............: avg=341.43µs min=267.29µs med=322.12µs max=6.9ms    p(90)=353.32µs p(95)=364.9µs 
     ✓ { mode:graphql }...........................: avg=365.62µs min=275.99µs med=333.44µs max=13.49ms  p(90)=377.15µs p(95)=414.14µs
     http_req_failed..............................: 0.00%   ✓ 0           ✗ 209477
     http_req_receiving...........................: avg=33.63µs  min=17.49µs  med=33.47µs  max=3.76ms   p(90)=39.25µs  p(95)=41.43µs 
     http_req_sending.............................: avg=8.14µs   min=5.94µs   med=7.19µs   max=4.22ms   p(90)=10.7µs   p(95)=11.44µs 
     http_req_tls_handshaking.....................: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting.............................: avg=319.98µs min=186.56µs med=282.98µs max=14.82ms  p(90)=420.85µs p(95)=437.77µs
     http_reqs....................................: 209477  1745.622266/s
     iteration_duration...........................: avg=568.06µs min=391.09µs med=527.38µs max=15.44ms  p(90)=673.21µs p(95)=697.67µs
     iterations...................................: 209477  1745.622266/s
     vus..........................................: 1       min=1         max=1   
     vus_max......................................: 2       min=2         max=2   
github-actions[bot] commented 2 months ago

🚀 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.6.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/urql-exchange 3.6.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/graphiql 4.3.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
graphql-yoga 5.6.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/nestjs 3.6.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/nestjs-federation 3.6.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-apollo-inline-trace 3.6.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/apollo-managed-federation 0.3.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-apollo-usage-report 0.0.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-apq 3.6.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-csrf-prevention 3.6.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-defer-stream 3.6.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-disable-introspection 2.6.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-graphql-sse 3.6.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-jwt 2.6.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-persisted-operations 3.6.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-prometheus 5.3.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-response-cache 3.8.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-sofa 3.6.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
@graphql-yoga/render-graphiql 5.6.1-alpha-20240710084647-0e18c8e7 npm ↗︎ unpkg ↗︎
github-actions[bot] commented 2 months ago
### 💻 Website Preview The latest changes are available as preview in: [https://1c79801b.graphql-yoga.pages.dev](https://1c79801b.graphql-yoga.pages.dev)