Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mu): add metric to track size of trace database #978

Open
jfrain99 opened this issue Aug 26, 2024 · 0 comments · May be fixed by #993
Open

feat(mu): add metric to track size of trace database #978

jfrain99 opened this issue Aug 26, 2024 · 0 comments · May be fixed by #993

Comments

@jfrain99
Copy link
Contributor

Background

Currently, we have a database called trace.sqlite which holds a record of all logs in the MU for debugging purposes. There is a script, running on a cron hourly, which first checks the size of the database, and then deletes some old rows if it is too big. A metric which returns the size of the trace database will be helpful for ensuring that script is running and the database is not ballooning.

Solution

A new metric gauge, called ao_mu_trace_db_size, can be implemented. To determine the size of the sqlite database, we can leverage PRAGMA:

db.pragma('page_size', { simple: true })
db.pragma('page_count', { simple: true })

Then, we can multiple page_size (usually 4096 bytes) by page_count to find the size of the database. We can do this on metric collection.

@jfrain99 jfrain99 linked a pull request Sep 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@jfrain99 and others