Disable features at build-time to reduce binary size?

I’m currently evaluating replacing promtail with Alloy as a log shipping client for the Loki setup at my employer, as the Loki docs say that promtail is feature complete and Agent is considered end-of-life.

I’ve managed to get Alloy up and running on a test machine with an equivalent config for shipping logs off to a Loki server without any issues. However, I was quite surprised that the binary is 285MB in size! This isn’t a total deal breaker, however rolling out Alloy as the standard log shipping client to our customers would mean nearly 300MB more OS disk usage on every customer machine, which is enough to be noticeable. (In practice, the disk usage would probably be greater than 300MB – we use NixOS, so when we update the version of Alloy, the old binary will be kept around on disk until it’s explicitly cleaned up at a later date.)

While I appreciate that Alloy is intended as an all-in-one solution, it does come with a lot of batteries included which we don’t necessarily need (e.g. all the Prometheus exporters). On the other hand, there are some Alloy features we’re interested in which aren’t available in promtail – such as WAL support.

In our use case it would be helpful if there were a way to reduce the set of integrations compiled into Alloy at build time, as we only need a small subset of the overall feature list. Is this something which is on the radar upstream? The way the code is structured at the moment means that removing integrations is a pretty invasive change, so it would be infeasible for me to maintain a patch removing the integrations we don’t need for our local build.

2 Likes

Hello! This is probably going to come up more and more as folks migrate off of Promtail.

Maybe we can make something like the OTel Builder but for Alloy? It’d be an application which can create a custom Alloy build using only a subset of the official components. And it could potentially include custom components from other Git repositories.

Such a product could also be useful for folks who want just the Prometheus components, just the OTel ones, or want to exclude some component for security reasons.

Would you like to open a feature request in the Alloy repo for such a feature?

1 Like

yeah, I only need a knife, fork and spoon set not the whole IKEA

Same can be said about grafana itself, it comes bloated with all kinds of default datasource and visualization plugins.

Sure, I’ve opened Build-time feature configuration to reduce binary size · Issue #2267 · grafana/alloy · GitHub.

1 Like