Description
Currently, there is no good way of limiting and reuse the amount of space that pt-stalk can consume. There are following tunables:
--disk-bytes-free
--disk-pct-free
--retention-time
But they only allow pt-stalk logs to not occupy all the space, and once it does it simply stops working until retention time passes for the first log.
Ideally, as SREs responsible for the service we would like to have an ability to limit the total amount of bytes that pt-stalk can consume, and after it goes over that limit it should switch to a ring buffer of logs, removing the oldest logs.
Is it possible to implement "retention-bytes" for explicitly limiting the space usage or at least "retention-count" to limit the number of traces that pt-stalk can handle.
Tasks
- Implement --retention-size option
- Implement --retention-count option
Retention Size
Limit the amount of space consumed by pt-stalk files based on size measurement of a directory.
Applies only to files under --dest
Pass in a friendly measurements using integer + letter, for example k, M, G, and T.
Default is 500M
--retention-size=1G # Don't collect further if we've used 1GB of space
Retention Count
Limit the amount of space consumed by pt-stalk files based on measuring count of collections performed.
Applies only to files under --dest
Accepts an integer value only.
--retention-count=100 # Collect up to 100 collects