-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Metricbeat test modules #4656
Metricbeat test modules #4656
Conversation
jenkins retest this |
36c49e6
to
4838798
Compare
It goes over all configured modules and runs them, reporting the resulting event to the user
jenkins retest this please |
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, I just left a few questions.
@@ -185,6 +186,11 @@ func (mw *Wrapper) Hash() uint64 { | |||
return mw.configHash | |||
} | |||
|
|||
// MetricSets return the list of metricsets of the module | |||
func (mw *Wrapper) MetricSets() []*metricSetWrapper { |
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.
Can this return []mb.MetricSet
instead? (Returning an unexported type from an exported method can be annoying to users.)
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.
That was my first though too, but then I would need to reimplement fetch, which is not a big deal but could cause issues when we add new metricset types, wdyt?
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.
Then that seems OK.
metricbeat/mb/module/wrapper.go
Outdated
// Reporter implementation | ||
|
||
type reporter interface { | ||
StartFetchTimer() | ||
Done() <-chan struct{} |
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.
Would it make sense to embed mb.PushReporter
in reporter
rather than duplicating the method signatures?
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.
totally, thanks for the tip :)
by embedding `mb.PushReporter` in it
fixed conflicts with master, all tests passing now :) |
|
||
config, err := b.BeatConfig() | ||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "Error initializing beat: %s\n", err) |
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 three "Error initializing beat" message above might get confusing at some point.
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 merged the PR, this is minor and can be handled in a future 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.
Yeah, as I have been adding new commands I feel the need for a common cmdline util to handle initialization and output
Removing needs_docs label because the command is documented here: https://www.elastic.co/guide/en/beats/metricbeat/master/command-line-options.html#test-command |
Add
metricbeat test modules
command, it goes over all configured metricsets and runs them, reporting the result back to the user:Filtering by module and metricset:
TODO: