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.
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 a client object to libhoney for isolating traffic #40
Add a client object to libhoney for isolating traffic #40
Changes from all commits
eeef19d
4240acb
fdcdc93
95f6ccb
7838da8
a500a26
b9ce6c1
dc684f5
647b92d
1c5f1c2
6ea6c07
b4aecc2
8b0dd45
08c75ea
00dbc3b
aa134f8
7bb922b
0fd79da
e89d0aa
c2a186f
90121c0
020d8ee
f673dec
c9399e9
f4991a9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not have another block above the
c
initialization, and guarantee thatNewClient
always returns an initialized logger?the Transmission stuff below already it this way.
come to think of it, the Transmission checks below should be rewritten into the same style as the things above:
and then can be included in the
&Client
initialization as withlogger
. wishBuilder
's initialization could be as well. that circular.client
ref is a nice future refactoring target.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not clear why that would be better. The way it is not the sync.Once gets triggered during initialization so all future calls quickly noop. Delaying that till the first place they’re hit makes for a more likely collision (and therefore block) doesn’t it?
Can you say more about the motivation for this suggested change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just makes initialization more consistent - right now there are 3 different patterns for
conf
fallback to initialize different fields in theClient
struct.The behavior you're trying to avoid (no
ensure*
call leading tosync.Once
collision later) is also how thec.transmission
initialization below acts :/How about both?
.builder
, since it requires the backref) to be consistent:conf
setting for nil, fallback by putting the one we want inconf
Client
init solely out ofconf
Client
init, call c.transmission.Start() so we can early error, then call bothensureLogger()
andensureTransmission()
to use up theirsync.Once
's before returning the client.