smira / go-statsd

Go statsd client library with zero allocation overhead, great performance and reconnects
MIT License
109 stars 18 forks source link

Add clone methods #13

Closed horkhe closed 5 years ago

horkhe commented 5 years ago

Sometimes in one application different subsystems use different metric prefixes. To help with that this PR introduces methods CloneWithPrefix and CloneWithPrefixExtension that return a new client object that has new prefix or original prefix + new prefix respectively. The new clients reuse the transport infrastructure of the original client. Closing an original client or any of its clones makes all of them stop. It is safe to call Close any number of times on any client by the way.

horkhe commented 5 years ago

Thank you for quick response. Could you please merge it and tag.