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

Fix for issues mentioned in PR #3448 #3457

Merged
merged 1 commit into from
Nov 5, 2024
Merged

Conversation

kroupacz
Copy link
Contributor

@kroupacz kroupacz commented Nov 4, 2024

Description

Fixes issues mentioned in PR #3448

  1. yoga version is not propagated well and string __YOGA_VERSION__ is sent to the trace
  2. clientName and clientVersion should not have any default values, because it is real identification of client (mobile app, web, ...). The client can send only the name or both (name and version) or even "nothing". Setting the default values in this case can make a lot of confusion and if the client does not send this information (name or version) any default values should not be definitely set!
  3. from this point of view, it doesn't make sense to add clientName and clientVersion to type ApolloUsageReportOptions as astring (custom function is good idea 👍 )
screenshot

Copy link

changeset-bot bot commented Nov 4, 2024

🦋 Changeset detected

Latest commit: 03da6e2

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-usage-report Patch
graphql-yoga Patch
@graphql-yoga/nestjs Patch
@graphql-yoga/render-graphiql Patch
@graphql-yoga/plugin-apollo-inline-trace Patch
@graphql-yoga/apollo-managed-federation Patch
@graphql-yoga/plugin-apq Patch
@graphql-yoga/plugin-csrf-prevention Patch
@graphql-yoga/plugin-defer-stream Patch
@graphql-yoga/plugin-disable-introspection Patch
@graphql-yoga/plugin-graphql-sse Patch
@graphql-yoga/plugin-jwt Patch
@graphql-yoga/plugin-persisted-operations Patch
@graphql-yoga/plugin-prometheus Patch
@graphql-yoga/plugin-response-cache Patch
@graphql-yoga/plugin-sofa Patch
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
@graphql-yoga/nestjs-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

/**
* Client version to report to the usage reporting API
*/
clientVersion?: StringFromRequestFn | string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

But this is a breaking change

Copy link
Contributor Author

@kroupacz kroupacz Nov 4, 2024

Choose a reason for hiding this comment

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

Technically you are right but it is still in 0.x.x version and according to semver docs it should not be big problem. However, it should be released as minor version. I will edit it. 👍

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we just seperate the fix and the breaking changes into different PRs?
Because this breaking change will affect dependent packages too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I separated "breaking changes" into a separate PR here #3458. Check it out please.

@@ -99,7 +98,7 @@ export function useApolloUsageReport(options: ApolloUsageReportOptions = {}): Pl
}

let clientVersionFactory: StringFromRequestFn = req =>
req.headers.get('apollographql-client-version') || yoga.version;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't it nicer to have some information about the sender even if it is not dynamic because otherwise the information becomes anonymous?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so. 🙂 It will always be an anonymous call, even if we add some default value here. Additionally, if someone sends only "client name", then some unrelated version value should not be added here. As I mentioned above, it would be a mess. 🙂
It is normal behavior for Apollo Studio that the client name or version does not always appear in the trace and these metrics can be still properly filtered (as "unidentified client"). Even the official implementation of this plugin does not assign any default values. Check it out here.

@kroupacz kroupacz requested a review from ardatan November 5, 2024 09:46
@ardatan ardatan merged commit 2523d9f into dotansimha:main Nov 5, 2024
30 checks passed
Copy link
Contributor

github-actions bot commented Nov 5, 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}
     ✓ no_errors{mode:uws}
     ✓ expected_result{mode:uws}

     checks.......................................: 100.00% ✓ 523844      ✗ 0     
     data_received................................: 2.1 GB  14 MB/s
     data_sent....................................: 105 MB  702 kB/s
     http_req_blocked.............................: avg=1.49µs   min=972ns    med=1.32µs   max=2.92ms   p(90)=1.96µs   p(95)=2.15µs  
     http_req_connecting..........................: avg=2ns      min=0s       med=0s       max=148.12µs p(90)=0s       p(95)=0s      
     http_req_duration............................: avg=359.32µs min=222.47µs med=324.21µs max=15.08ms  p(90)=457µs    p(95)=477.22µs
       { expected_response:true }.................: avg=359.32µs min=222.47µs med=324.21µs max=15.08ms  p(90)=457µs    p(95)=477.22µs
     ✓ { mode:graphql-jit }.......................: avg=291.74µs min=222.47µs med=269.08µs max=15.08ms  p(90)=300.66µs p(95)=317.8µs 
     ✓ { mode:graphql-no-parse-validate-cache }...: avg=482.77µs min=400.26µs med=457.88µs max=8.92ms   p(90)=494.91µs p(95)=521.72µs
     ✓ { mode:graphql-response-cache }............: avg=339.21µs min=267.75µs med=320.95µs max=6.62ms   p(90)=351.13µs p(95)=362.57µs
     ✓ { mode:graphql }...........................: avg=374.26µs min=274.4µs  med=337.87µs max=13.59ms  p(90)=399.29µs p(95)=449.68µs
     ✓ { mode:uws }...............................: avg=342.06µs min=270.4µs  med=321.86µs max=9.44ms   p(90)=353.19µs p(95)=368.07µs
     http_req_failed..............................: 0.00%   ✓ 0           ✗ 261922
     http_req_receiving...........................: avg=33µs     min=16.45µs  med=33µs     max=875.1µs  p(90)=38.71µs  p(95)=40.93µs 
     http_req_sending.............................: avg=8.35µs   min=5.98µs   med=7.39µs   max=825.23µs p(90)=10.85µs  p(95)=11.64µs 
     http_req_tls_handshaking.....................: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting.............................: avg=317.97µs min=189.78µs med=283.61µs max=14.93ms  p(90)=415.53µs p(95)=433.41µs
     http_reqs....................................: 261922  1746.128813/s
     iteration_duration...........................: avg=567.78µs min=390.17µs med=529.86µs max=15.62ms  p(90)=668.39µs p(95)=693.06µs
     iterations...................................: 261922  1746.128813/s
     vus..........................................: 1       min=1         max=1   
     vus_max......................................: 2       min=2         max=2   

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