-
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: Add mapping for docker metrics per cpu #6843
Metricbeat: Add mapping for docker metrics per cpu #6843
Conversation
2e3ea14
to
2025f9f
Compare
This will probably not work. You have to use dynamic templates for this: https://www.elastic.co/guide/en/elasticsearch/reference/6.2/dynamic-templates.html So far the way we use dynamic templates is that we specify it as following:
In the template this outputs:
I could be that for this case an extension to our template generation is needed. Best have a look at |
2025f9f
to
b0fcb07
Compare
libbeat/template/processor.go
Outdated
@@ -242,12 +258,16 @@ func addDynamicTemplate(f *common.Field, properties common.MapStr, matchType str | |||
if len(f.Path) > 0 { | |||
path = f.Path + "." | |||
} | |||
path_match := path + f.Name | |||
if !strings.ContainsRune(path_match, '*') { | |||
path_match += ".*" |
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.
don't use underscores in Go names; var path_match should be pathMatch
libbeat/template/processor.go
Outdated
@@ -242,12 +258,16 @@ func addDynamicTemplate(f *common.Field, properties common.MapStr, matchType str | |||
if len(f.Path) > 0 { | |||
path = f.Path + "." | |||
} | |||
path_match := path + f.Name |
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.
don't use underscores in Go names; var path_match should be pathMatch
11b7a99
to
e144525
Compare
Trying to generate the dynamic mapping, still have to test it for real. |
e144525
to
80a4e3c
Compare
@@ -208,6 +209,21 @@ func (p *Processor) object(f *common.Field) common.MapStr { | |||
} | |||
|
|||
switch f.ObjectType { | |||
case "scaled_float": |
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.
Probably we will have a request for float and integer here pretty soon. As soon this pops up we should refactor the code to remove the duplicated parts, if possible
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.
Just saw further below that long we already have. float should be rather simple to add in the same manner.
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.
For scaled float I could reuse the existing scaledFloat
method.
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.
We can still clean up the code in a follow up PR.
Change looks good to, looking forward to your manual testing. The template can be exported with |
74fe717
to
333aa1c
Compare
@@ -208,6 +209,9 @@ func (p *Processor) object(f *common.Field) common.MapStr { | |||
} | |||
|
|||
switch f.ObjectType { | |||
case "scaled_float": | |||
dynProperties = p.scaledFloat(f) | |||
addDynamicTemplate(f, dynProperties, matchType("*")) |
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 use *
by default because we want it to match at least all numeric types.
jenkins, test it again please, it seems that there has been an issue with pypi |
jenkins, test it |
jenkins, test this again |
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.
Did you manage to test this locally? Code LGTM. PR will need need a rebase because of the CHANGELOG.
@@ -208,6 +209,21 @@ func (p *Processor) object(f *common.Field) common.MapStr { | |||
} | |||
|
|||
switch f.ObjectType { | |||
case "scaled_float": |
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.
We can still clean up the code in a follow up PR.
333aa1c
to
9553a5e
Compare
Yes, I could test it locally, it works fine :) Branch rebased. |
CHANGELOG.asciidoc
Outdated
@@ -79,6 +79,8 @@ https://github.com/elastic/beats/compare/v6.0.0-beta2...master[Check the HEAD di | |||
- Fix Kubernetes calculated fields store. {pull}6564{6564} | |||
- Exclude bind mounts in fsstat and filesystem metricsets. {pull}6819[6819] | |||
- Don't stop Metricbeat if aerospike server is down. {pull}6874[6874] | |||
- Fix Kubernetes calculated fields store. {pull}6564[6564] |
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.
Seems like that line of changelog sneaked in?
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.
Umm, I don't know why this happens :? removing it
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.
rebase with 3 way merges. Unfortunately a common issue.
9553a5e
to
b4ee1da
Compare
@ruflin Will this go into any of the 6.x releases as well? |
@ctindel yes, 6.3 |
Fixes #6785