Usage Data in Gadget
Hi,
My Gadget usage exceeds 100hours every month. Are there any tips on how to reduce usage?
I stopped automatic store syncing. Reduced models syncing on store install with
await api.shopifySync.run({
shopifySync: {
domain: record.domain,
shop: {
_link: record.id,
},
models: [
"shopifyProduct",
"shopifyCollection",
"shopifyMarket",
"shopifyMarketRegion",
"shopifyMarketWebPresence",
"shopifyProductVariant",
"shopifyShop",
"shopifyAppSubscription",
],
},
});
Any more tips on what we can do here?
I noticed that queries like this to delete data also cause usage to grow:
await api.internal.shopifyCart.deleteMany({ filter: { shopId: { equals: shopId } } });
Is there like a basic 101 article on what is usage and how can we optimize? Please do help share any optimizating tricks that worked for you. Thanks.
9 Replies
Hi Gaurav,
A few tips are having your packages up to date. I believe you recently updated your Shopify API so that is good.
Another way to reduce usage would be adding webhook filters.
I have docs here for webhook filters: https://docs.gadget.dev/guides/plugins/shopify/shopify-webhooks#applying-a-webhook-filter
Thanks.
Is there a way to see more granular data around usage. like today I ran some queries via api playground and on usage page I see suddenly my usage increased. Does running api queries increase usage?
Have you looked at the Usage tab, and the filtering options? It can show you where the runtime hours are being used
In the billing section
Yes I did. Now my main issue is actually from that data. It shows majority of usage was in sync via shopifyCollect, shopifyProductVariant and shopifyOrderLineItem
Now I dont have Collect and OrderLineItem setup on sync upon install and I do not sync stores periodically i.e. my store sync trigger is off. so ideally shopifyCollect and shopifyOrderLineItem should not come as part of sync at all. I am trying to debug this.



First image is from gadget and other two are from webhook deliveries from shopify in last 24hrs
Im looking into this
Thanks 🙏
In your production environment you are subscribed to those models webhooks, I also see that most of the stored ran a sync 3 days ago
which is the day you had the spike in usage
So we ran a sync using the sync button in Installs for some store 4 days back and that results in spike 4 days back.
Above is data from yesterday. We did not run a store sync yesterday and we are subscribed to those model webhooks (Until today) but it should not appear as "Sync" in the Usage table like shopifyCollect - Sync right?
This is sorted Mark. we just re-worked on the app and deleted a lot of models/webhooks that were not needed or worked around them to reduce our usage drastically 🙂