slok/go-http-metrics

Refactor to "plugin" model

bduffany opened this issue · 2 comments

This package looks super useful, but I wound up not using it because it has a bunch of deps on several different HTTP frameworks, which significantly increased the size of our go.sum.

It would be nicer to have a "plugin" model where you go get each framework-specific plugin separately, to avoid dependency bloat. (IMO the built-in "net/http" plugin could be included in this repo but the other 3rd-party frameworks should be separate repos).

slok commented

Hi @bduffany!

Thanks for your kind words!

The library tackles already the problem you are saying, when you import go-http-metrics, each of the library/framework dependency has its own package for this reason so you don't import all of them.

I've put here an example so you can check by yourself that you are not importing N frameworks while using this library: https://github.com/slok/go-http-metrics-imports

Regarding the go.sum thing, we can't do anything about that, it's how Go stores the data.

Anyway IMHO, having those lines in the go.sum is not a big deal while the dependencies don't end up on the application. In the end is just a text file for computers, not humans (contrary to go.mod that is common to read it).

Thanks!

slok commented

I'm closing the issue, if you need more information, please reopen the issue. Thanks!