cortex-tools icon indicating copy to clipboard operation
cortex-tools copied to clipboard

cortex-tools client results in huge binary

Open malcolmholmes opened this issue 4 years ago • 3 comments

The cortex-tools project includes a client for the cortex-ruler. This, in itself, seems pretty simple. However, including the client into a simple golang app causes that app to go from 12->72Mb, importing Cortex, AWS CLI, and lots of other things.

Is it possible to simplify the client such that it doesn't increase binary size so much?

malcolmholmes avatar Oct 11 '20 21:10 malcolmholmes

@owen-d

I think this is caused by importing this package from Loki: https://github.com/grafana/cortex-tools/blob/432ad779ae0f28552ffe7f1f0d6ddd3c32b52210/pkg/rules/parser.go#L10

Would it be possible to isolate the ValidateGroup function into a package that doesn't include so many vendored dependencies or fork the code here?

jtlisi avatar Oct 12 '20 14:10 jtlisi

I don't think this is just the ValidateGroup function, there's also the logql parser for linting of rules that's importing a big portion of loki.

gotjosh avatar Oct 26 '20 09:10 gotjosh

Good catch @jtlisi. When I initially added Loki support, I blanked added the entire project as a dependency. Likely we can slim this down substantially.

owen-d avatar Nov 18 '20 14:11 owen-d