Move main logic into a sub-package for easier re-use #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request satisfies #3.
One thing that I'd like some other peoples' opinion on is the interface for creating and configuring a
Collector
. Currently there is aConfig
struct that is passed into theNew
constructor, and aDefaultConfig
that defines aConfig
pre-populated with useful defaults. This was done mainly so that thebool
config values could default totrue
rather thanfalse
.Ideally I would like to have something more like this:
The problem here is that I would have to change the
Enable*
toDisable*
which seems not ideal as we would need double negatives in the codeif !c.DisableCPU {
. But perhaps it is the best way to do it to make the interface easier to understand and closer to what is done in the standard library (likehttp.Server
)Once we've decided what we want the interface to be I will change it to be that way and add in comment on the exported types as well as a package comment on
go-runtime-metrics/collector
.