grafana / cortex-tools

If you're using this tool with Grafana Mimir, please switch to "mimirtool" instead: https://github.com/grafana/mimir
Apache License 2.0
157 stars 68 forks source link

cortex-tools client results in huge binary #100

Open malcolmholmes opened 4 years ago

malcolmholmes commented 4 years ago

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?

jtlisi commented 4 years ago

@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?

gotjosh commented 4 years ago

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.

owen-d commented 4 years ago

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.