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
[exporter/clickhouse] Default
async_insert
to true. Added related config option. #32340[exporter/clickhouse] Default
async_insert
to true. Added related config option. #32340Changes from all commits
eb2846b
3c29f65
c86cb3d
de5e454
c50e222
59265ee
8b97159
55db013
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 is this a pointer instead of just a value? The only reason I could think of would be for it to be empty, as in your tests, but this is
true
by default, so it couldn't be empty, as far as I can tell.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.
The default only gets applied if it's not in
endpoint
/connection_params
AND ifcfg.AsyncInsert
isnil
.If it were a regular
bool
, Go would initialize the struct withfalse
, and so in the config parsing, I wouldn't be able to determine if it was set tofalse
by the user or by the struct's initialization.So the code would look like:
So if I wanted it to remain
false
in my config, it would never work, I would have to set it inendpoint
orconnection_params
.This is similar to the
database
config option, except in that case Go will initialize it to""
, so the code checks for that instead ofnil
.TL;DR: false is
false
, true istrue
,nil
istrue
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.
Okay, I think I understand your concern. However, the way configurations are parsed by the collector works in this case. It first calls createDefaultConfig, then parses whatever configuration the user defined, overwriting any default values with given values (and leaving default values as-is if not defined by user). This is done here, for reference.
So even if you have a
bool
with defaulttrue
, if you set it totrue
increateDefaultConfig
, it will only be overwritten if the user specifiesasync_insert: false
in their config.So would it work to use
bool
for your use case, or is there more reason than that?I realize this logic is a bit involved and complicated since this variable is coming from potentially three different places, so would it work to add some kind of getter method that will handle precedence of different sources of
async_insert
and then require all references be to the getter method instead of directly parsing config options?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.
Hey @SpencerTorres, I was wondering if you got a chance to test this, or look into it more?