Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clone methods #13

Merged
merged 1 commit into from
Nov 16, 2018
Merged

Add clone methods #13

merged 1 commit into from
Nov 16, 2018

Conversation

horkhe
Copy link
Contributor

@horkhe horkhe commented Nov 15, 2018

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.

Copy link
Owner

@smira smira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, looks good to me!

another approach might have used interface-compatible PrefixedClient instances which append new prefix on each call to original client, but this looks cleaner

@horkhe
Copy link
Contributor Author

horkhe commented Nov 16, 2018

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

@smira smira merged commit 133607a into smira:master Nov 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants