-
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
Index metricset for elasticsearch Metricbeat module #6881
Changes from 1 commit
1581858
32cb62a
ef53fba
cc74589
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//// | ||
This file is generated! See scripts/docs_collector.py | ||
//// | ||
|
||
[[metricbeat-metricset-elasticsearch-index]] | ||
=== Elasticsearch index metricset | ||
|
||
experimental[] | ||
|
||
include::../../../module/elasticsearch/index/_meta/docs.asciidoc[] | ||
|
||
|
||
==== Fields | ||
|
||
For a description of each field in the metricset, see the | ||
<<exported-fields-elasticsearch,exported fields>> section. | ||
|
||
Here is an example document generated by this metricset: | ||
|
||
[source,json] | ||
---- | ||
include::../../../module/elasticsearch/index/_meta/data.json[] | ||
---- |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,25 +151,38 @@ func NewReportingMetricSetV2(t testing.TB, config interface{}) mb.ReportingMetri | |
return reportingMetricSetV2 | ||
} | ||
|
||
type capturingReporterV2 struct { | ||
// CapturingReporterV2 is a reporter used for testing which stores all events and errors | ||
type CapturingReporterV2 struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exported type CapturingReporterV2 should have comment or be unexported |
||
events []mb.Event | ||
errs []error | ||
} | ||
|
||
func (r *capturingReporterV2) Event(event mb.Event) bool { | ||
// Event is used to report an event | ||
func (r *CapturingReporterV2) Event(event mb.Event) bool { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exported method CapturingReporterV2.Event should have comment or be unexported |
||
r.events = append(r.events, event) | ||
return true | ||
} | ||
|
||
func (r *capturingReporterV2) Error(err error) bool { | ||
// Error is used to report an error | ||
func (r *CapturingReporterV2) Error(err error) bool { | ||
r.errs = append(r.errs, err) | ||
return true | ||
} | ||
|
||
// GetEvents returns all reported events | ||
func (r *CapturingReporterV2) GetEvents() []mb.Event { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exported method CapturingReporterV2.GetEvents should have comment or be unexported |
||
return r.events | ||
} | ||
|
||
// GetErrors returns all reported errors | ||
func (r *CapturingReporterV2) GetErrors() []error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exported method CapturingReporterV2.GetErrors should have comment or be unexported |
||
return r.errs | ||
} | ||
|
||
// ReportingFetchV2 runs the given reporting metricset and returns all of the | ||
// events and errors that occur during that period. | ||
func ReportingFetchV2(metricSet mb.ReportingMetricSetV2) ([]mb.Event, []error) { | ||
r := &capturingReporterV2{} | ||
r := &CapturingReporterV2{} | ||
metricSet.Fetch(r) | ||
return r.events, r.errs | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
- module: elasticsearch | ||
metricsets: ["node", "node_stats"] | ||
metricsets: | ||
#- index | ||
- node | ||
- node_stats | ||
period: 10s | ||
hosts: ["localhost:9200"] |
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 ID doesn't to exist
exported-fields-elasticsearch
?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.
weird, as it is here: https://github.com/elastic/beats/pull/6881/files#diff-d43087d796b8b1d1ff48ec3561aeda60R3286
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.
@exekias I really think the error here is related to how our tests are written, not the doc source. I tested the files offline and they build without errors. I think it's safe to ignore the error messages here.