What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Canges in costs of requests to the GraphQL Admin API

Canges in costs of requests to the GraphQL Admin API

Jan-S
Shopify Partner
6 0 0

Hello,

First of all I am glad that the costs of the GraphQL have been reduced.

But I was wondering how the costs where calculated at all now.

 

Via datamining i found out that connection costs are now weighted by log of base e^0.5.
Is there any documentation of that? Can the documentation be updated to reflect that?
It is quite tedious to figure out all the changes..

Replies 3 (3)

ShopifyDevSup
Shopify Staff
1453 238 525

Hey @Jan-S , thanks for sharing this. 

 

Currently, our documentation is limited to what we have available here: https://shopify.dev/docs/api/usage/rate-limits#cost-calculation and it's mentioned that "The cost of a query is the maximum of possible fields selected. Running a query is the best way to find out its true cost" which looks like what you have been doing. 

 

I would love to pass on your feedback to our product teams to get a better understanding of what's missing, along with a little more context on how you're using this information (as you mentioned it's quite tedious). If you could share a little bit more about your use case and the need for more clear documentation, that would really help me present this best! 

 

Kind Regards, 

 

- Kyle G.

 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Jan-S
Shopify Partner
6 0 0

Well, this is not true anymore.

The cost is calculated with "the maximum of possible fields selected" but it is not "the maximum of possible fields selected" but

log("the maximum of possible fields selected") / log(e^0,5)

Also this is just an opinion, but running a query to look how mutch it MAY cost is kind of problematic for me.

Especialy IF the rules change like recently. Because now you need to check your entire code, run all the queries again and change all the points.

 

I build a small tool based on the "graphql-tag" package that was able to predict the cost of a query.

Why is this not part of the GQL client?

ShopifyDevSup
Shopify Staff
1453 238 525

Hey @Jan-S

 

Thanks for sharing that. I've passed this feedback on to our product teams to consider making this more clear. 

 

Thanks, 

 

Kyle G. 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog