cloud-carbon-footprint / cloud-carbon-footprint

Cloud Carbon Footprint is a tool to estimate energy use (kilowatt-hours) and carbon emissions (metric tons CO2e) from public cloud usage
https://cloudcarbonfootprint.org
Apache License 2.0
872 stars 288 forks source link

Graph is empty after first reload of the page (on ~daily basis) #1333

Open pygospa opened 2 months ago

pygospa commented 2 months ago

We have CCF installed on AWS and are experiencing a rather strange behavior in the Cloud Usage chart: The very first time one of our devs accessed the site, we had a "normal" chart.

image

But any other dev got an empty graph. We've tried this on different Linux distributions and with different browsers. The very first dev also lost the graph, once reload was hit, or the exact page was opened in a second tab; so we tried the incognito mode as well, to make sure there isn't some client side issue with stored data. A day later we where once again able to see the curve for the very first time of opening the page.

image

We tried debugging this ourselves and had following findings:

image

This points to the issue #1069 , from March last year; however the solution suggested there was to use Node 18. We are currently using release: 'release-2024-02-11'; and we rechecked that Node 18 is used by client and server, which is the case.

So, though the symptoms are identical to issue #1069 , the root cause must be somewhere else.

jochen-schuettler commented 2 months ago

There are 2 instances from the same domain, which have slightly different behavior:

jochen-schuettler commented 2 months ago

Also, to validate against issue https://github.com/cloud-carbon-footprint/cloud-carbon-footprint/issues/1069, we tried CCF on an entirely separate AWS account, setting it up by Terraform. (The one above was set up using Helm). Regardless of node 16, 18 or 20, there is no issue, i.e. the graphs are always visible.

ddias00 commented 2 months ago

"I'm facing the same issue.

I'm using Helm for deployment on EKS with the release version release-2024-02-11."

first run

Anotação 2024-04-26 080243

second run

image

logs: cloud-carbon-footprint-api-5bcd879796-h9xcr_cloud-carbon-footprint.log

"It seems like a caching issue."

ddias00 commented 2 months ago

https://github.com/cloud-carbon-footprint/cloud-carbon-footprint/issues/1069

It seems like my issue is identical to that one, but I'm using the latest image from the Docker Hub repository and still encountering the problem.

ddias00 commented 2 months ago

I solved it using the cache in Mongo Atlas.

jochen-schuettler commented 2 months ago

It turned out that the cache was disabled on our own account, where the problem was not visible. On activating the cache the problem appears, unrelated to node version. I guess if we follow https://github.com/ddias00 's advice and utilize MongoDB, it will let the problem vanish again. So - The problem is only with local cache, which will be deprecated, but is still the default, as per documentation!

4upz commented 1 month ago

@pygospa Thanks for opening this issue and for making it so detailed! Big thanks to everyone on the collaborative troubleshooting.

From first impression, this definitely sounds like a cache-specific issue mixed in with some weird behavior from Apex charts. @jochen-schuettler I completely agree with your point that even though the local cache method is no longer supported, this is still a problem since it's the default option. I believe it has come up enough that warrants an investigation into the root cause alongside a fix.