self-hosted icon indicating copy to clipboard operation
self-hosted copied to clipboard

How to handle disk space usage of debug files

Open emrys90 opened this issue 1 year ago • 6 comments

Problem Statement

I build for 3 Unity platforms, and the debug files that gets uploaded per platform is over 1gb. So per build that is over 3gb of debug files that gets uploaded.

I typically do beta builds around once a day or so. Which adds up to over 100gb of debug files per month.

What are my options for handling this? I only really care about the most recent beta and production debug files, and not previous builds.

Solution Brainstorm

No response

emrys90 avatar Jun 21 '24 21:06 emrys90

You could have a scheduled cron job that cleans up those debug files. If anything is older than a few days old. Something like https://github.com/getsentry/self-hosted/blob/da06c0f230454b91fada3980ba2e1e012cedf1d2/docker-compose.yml#L481, but cleaning up the sentry-data volume instead, which is what I think houses debug files.

hubertdeng123 avatar Jun 24 '24 23:06 hubertdeng123

So there's no built in system for it, for example something like SENTRY_EVENT_RETENTION_DAYS, but that is for debug files instead?

And I don't think deleting anything older than a couple days on its own would work? As according to documentation, debug files are deleted when not used for more than 90 days, rather than being 90 days old. So I would want to delete any files not used for more than 2 weeks or so potentially, which should cover making sure they are always available if needed.

emrys90 avatar Jun 25 '24 00:06 emrys90

There is not a built in system for this, no. I have looked into this more, and I believe our sentry cleanup job that runs periodically that should clean up the models corresponding to the files and debug file models that live in postgres. However, I believe in order to actually free up disk space you would need to do a VACUUM FULL or something similar to ensure that the disk space is freed up.

https://www.rdiachenko.com/posts/databases/postgresql/postgresql-does-not-free-up-physical-space-after-delete/#:~:text=Q%3A%20How%20Do%20I%20Reclaim,frees%20space%20for%20future%20use.

hubertdeng123 avatar Jun 26 '24 22:06 hubertdeng123

Could I propose this being added as a feature then? Seems like it would be useful for anyone uploading debug files on a regular basis. I have no knowledge of the code base, but I would assume it would just be converting whatever is running the duration for cleaning up debug files to use an environment variable instead so users can configure it.

emrys90 avatar Jun 27 '24 09:06 emrys90

Sure, this can be a feature request. Please be aware this is probably not something we can get to in the near term though.

hubertdeng123 avatar Jun 28 '24 22:06 hubertdeng123

Great, thank you!

emrys90 avatar Jun 28 '24 23:06 emrys90