Estimating cost of Google App Engine API script using “x-appengine-estimated-cpm-us-dollars” header

199 Views Asked by At

I created an API using Python + FastAPI and deployed it to Google App Engine and I would like to measure the cost for each request made.

I saw there is a header "x-appengine-estimated-cpm-us-dollars" that show up when logged in with the owner account on GAE, but I didn't see it when accessed the API using the browser "https://example.uc.r.appspot.com/api"

Any idea how to can I see this header or a way to get an estimated cost for each request made?

Note: the deployed script is an API, not a website with auth like the one mentioned here (Usage of X-AppEngine-Estimated-CPM-US-Dollars in AppEngine)

1

There are 1 best solutions below

0
On

According to the documentation:

If you access dynamic pages on your site while signed in using an administrator account, App Engine includes per-request statistics in the response headers

And then shows the description for this particular header, therefore, this is not something that is available for APIs hosted in AppEngine.

You could alternatively use the Cloud Billing API to gather some information, although not exactly the same.