Monitor your Package Activity and Save on Storage!
With the introduction of the Package Activity API and accompanying CLI command, you can now quickly and easily check your entire repository for packages' activity status or even take a detailed approach and view packages individually (per day/per package). You can save on your storage costs by eliminating inactive packages and retaining only the packages you or your users derive value from storing and distributing via Cloudsmith. The excellent news is that once you identify those inactive packages, you can make use of Automated retention/lifetime rules (available on the Velocity plan and above). These rules allow you to automatically manage storage for packages by deleting or moving packages that fall outside of the defined retention rules.
Assets can be expired based on the number of packages (count), size of packages (bytes), or by the number of days (time); however, to first create these rules, you first need to understand how your users are interacting with your existing packages. Understanding when to delete the packages was challenging, until now!
So how does it work?
Every package has an aggregated count of the number of total downloads for a given package calculated daily. A package is considered active when there have been downloads for that package for a given range. If there are no downloads during a specified period, then it's deemed to be inactive.
The easiest way to get started exploring these metrics is to check out the metrics command within the Cloudsmith CLI. Alternatively, to get more fine-grained metrics, you can implement a programmatic solution using our API or one of the API binding libraries published in various languages.
For example, to check if a package has ever been "active" and received downloads, you can request the "packages" metric for an entire repository and use the --inactive=true flag to display a list of inactive packages to identify candidates that will help you create a retention rule to automate the removal in future.
Getting started quickly
Using the Cloudsmith CLI you can quickly and easily query the total number of active/inactive packages for your repository by running the following command with your organisation/repository.
Although the summary overview provides a general feel for the increase/decrease of inactive/active packages, it can be useful to drill down into what those packages are by using the `--active-packages=true` or `--inactive-packages=true` flags to identify what's been added or what can potentially be removed.