-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
allow specifying multiple collectors #624
Conversation
Codecov Report
@@ Coverage Diff @@
## master #624 +/- ##
==========================================
+ Coverage 64.51% 65.04% +0.52%
==========================================
Files 98 98
Lines 7829 7838 +9
==========================================
+ Hits 5051 5098 +47
+ Misses 2488 2436 -52
- Partials 290 304 +14
Continue to review full report at Codecov.
|
cmd/common.go
Outdated
@@ -100,6 +100,25 @@ func getNullString(flags *pflag.FlagSet, key string) null.String { | |||
return null.NewString(v, flags.Changed(key)) | |||
} | |||
|
|||
func getNullStrings(flags *pflag.FlagSet, key string) []null.String { |
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.
As I mentioned in the kafka PR, I don't think it's necessary it to have null.String
slices.
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.
Yep, I'll get this updated
cmd/config.go
Outdated
Linger null.Bool `json:"linger" envconfig:"linger"` | ||
NoUsageReport null.Bool `json:"noUsageReport" envconfig:"no_usage_report"` | ||
NoThresholds null.Bool `json:"noThresholds" envconfig:"no_thresholds"` | ||
Out []null.String `json:"out" envconfig:"out"` |
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.
See comment above about []null.String
.
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.
😄
cmd/config.go
Outdated
c.Out = cfg.Out | ||
for _, o := range cfg.Out { | ||
if o.Valid { | ||
c.Out = append(c.Out, o) |
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.
This would make it so there's no way to actually override a configured collector from a lower level. If we (after fixing #587) specify a collector in the exported script options, there wouldn't be a way to actually override it from the CLI options, like we could do with all the other options.
cmd/run.go
Outdated
@@ -125,19 +125,21 @@ a commandline interface for interacting with it.`, | |||
// defaults in there, override with Runner-provided ones, then merge the CLI opts in | |||
// on top to give them priority. | |||
fmt.Fprintf(stdout, "%s options\r", initBar.String()) | |||
cliConf, err := getConfig(cmd.Flags()) | |||
|
|||
defaultConf := Config{Options: r.GetOptions()} |
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.
Ah, unfortunately this would break some stuff 😒... We have to use the cliConf
as the base from which to build the config (and also Apply()
it last) because it both contains the default values for different options AND is the highest user-supplied config set in the configuration hierarchy...
For example if you try running the code as it is without specifying VUs anywhere, it won't run because the number of VUs would be 0
.
I'm sorry you have to deal with this, we'll hopefully fix the configuration mess soon. I'm still collecting pain points, issues and unexpected behaviours, but I'll soon create a github issue that comprehensively describes the current problems with option and configuration handling. For the moment, to avoid breakage, please don't touch the sacred 💩 that is cliConf.Apply(fileConf).Apply(Config{Options: r.GetOptions()}).Apply(envConf).Apply(cliConf)
😒
if len(e.Collectors) > 0 { | ||
for _, collector := range e.Collectors { | ||
collectorwg.Add(1) | ||
go func(collector lib.Collector) { |
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 sure we need goroutines here, see my comment about Collect()
in the kafka PR.
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.
So I didn't add it, I'm just using what was already there ... did you want me to work on removing it? Should that be in scope for this PR?
But I can play with it ... maybe it would help address the issue of why I switched from Run()
to Collect()
for sending the samples to Kafka that I was talking about in the Kafka PR.
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.
Argh, my bad, I misread the diff and the collector method called, ignore my comment entirely. It's exactly how it's supposed to be and your changes are perfectly fine.
I think I got everything addressed. Thanks! |
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.
LGTM! @luizbafilho, please take a look at this as well
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.
LGTM
Taking a stab at #620
Example: