segmentio / stats

Go package for abstracting stats collection
https://godoc.org/github.com/segmentio/stats
MIT License
208 stars 32 forks source link

datadog/client.NewClientWith swallows errors #97

Open shawnHartsell opened 5 years ago

shawnHartsell commented 5 years ago

When constructing a new DataDog client with this method, I noticed that if the call to dial fails the error is only logged. Returning the error would let callers take specific actions during their application's initialization.

I realize this proposal is a breaking change; if you all think this is a good idea I would be willing to create the patch!

achille-roussel commented 5 years ago

For context, this has never really been an issue because it's pretty easy to spot when metrics just don't work.

If this is a feature you need we can introduce a new function that constructs the client but also returns any error that it would observe (NewClientWithError?), I don't think we have to make it a breaking change.

What do you think?

shawnHartsell commented 5 years ago

Makes sense, and yes, something like NewClientWithError would work.

Specifically, I'm instrumenting a business critical service and want to have the option to not spin it up if initialization fails (e.g. bad addr, an internal error making the sys calls, etc)