autometrics-dev / am

Autometrics Companion CLI app
Apache License 2.0
16 stars 2 forks source link

Provide a command to delete data #104

Open IvanMerrill opened 1 year ago

IvanMerrill commented 1 year ago

I was playing around with some SLOs and experimenting with a test app and I was confused by the stale data I had. I hadn't realised that the data is being stored in a local data folder located in the fold I ran the am command from.

I do wonder if this location should be made more obvious or made consistent so you don't end up with lots of data folders all around the place. More than that though, it feels like there should be a command to clear this data, like an am refresh command or something similar that will wipe the data so you can start again cleanly.

For me this is particularly important in local development where you might be changing function names, SLO names, the SLOs you have etc.

hatchan commented 1 year ago

I was playing around with some SLOs and experimenting with a test app and I was confused by the stale data I had. I hadn't realised that the data is being stored in a local data folder located in the fold I ran the am command from.

Please update to the latest version if you haven't done so already. You can delete the data directory, that is now stored in the .autometrics directory.

For me this is particularly important in local development where you might be changing function names, SLO names, the SLOs you have etc.

I think in the case where you are changing things it is more useful to actually see the change reflected in Prometheus/explorer. But it should also be possible to clear all the data once you verified it.

For now you can just delete the .autometrics directory. You can also startup am start with --ephemeral, which will make sure that all the prometheus data is deleted once you stop am.

We should also expose this behavior through the am api. This will allow the explorer to invoke it and thus the user will be able to simply click a button in the UI.

brettimus commented 1 year ago

i'd +1 for a command in the help menu that tells you how to clear data

Nlea commented 1 year ago

+1 just run into the same issue It would be good to let people know that the directory .autometrics is created from where you start AM. It can be confusing, especially if you consider it as a separate tool that you don't start from the same directory than your application.

Maybe also am system prune can look if the folder .autometrics exist from where you run the prune command and ask you if you like to delete the data as well. And if it can't find the .autometrics directory from the place you run the prune command it can notify you that it is not there but you might still have it somewhere...

jimvdl commented 1 year ago

There is also the option to place the .autometrics directory in the home/local/cache directory with the help of the dirs crate to give it a centralized location. Although I'm not sure how applicable this might be, I still wanted to make a note of it in case it might be useful.

hatchan commented 1 year ago

There is also the option to place the .autometrics directory in the home/local/cache directory with the help of the dirs crate to give it a centralized location. Although I'm not sure how applicable this might be, I still wanted to make a note of it in case it might be useful.

Thanks for the suggestion. We are already using that crate for determining where to download the prometheus/pushgateway binary. The reason we are using the local directory for Prometheus' storage is that each project (most likely organized as separate directories) will get it own unique data.