Add Fields and Tag to monitor config#4141
Conversation
|
Jenkins standing by to test this. If you aren't a maintainer, you can ignore this comment. Someone with commit access, please review this and clear it for Jenkins to run. |
1 similar comment
|
Jenkins standing by to test this. If you aren't a maintainer, you can ignore this comment. Someone with commit access, please review this and clear it for Jenkins to run. |
|
@glefloch Haven't checked the code yet, but could you add a changelog entry? |
|
Oh yes for sure, I'm doing it right now |
ruflin
left a comment
There was a problem hiding this comment.
I haven't looked into it yet but I was kind of hoping we could add the meta data either in monitors package or even beater package as it is generic for all monitors. The way it is added at the moment it has to be implemented for each monitor. Means if someone adds a new monitor the code also has to be added.
Can you check if there is an option to add the code on a more global level?
heartbeat/heartbeat.full.yml
Outdated
There was a problem hiding this comment.
This must be added to heartbeat/_meta/beat.full.yml and then you have to run make update.
There was a problem hiding this comment.
Ok, I'm reverting those modifications.
heartbeat/heartbeat.full.yml
Outdated
There was a problem hiding this comment.
I suggest we add it only to one monitor (first one) as an example and not every single one.
heartbeat/heartbeat.full.yml
Outdated
There was a problem hiding this comment.
Can you call it err instead of e to be consistent with most of the other code?
There was a problem hiding this comment.
Yes I will update the name.
Codecov Report
@@ Coverage Diff @@
## master #4141 +/- ##
==========================================
- Coverage 64.64% 64.59% -0.05%
==========================================
Files 490 491 +1
Lines 34392 34440 +48
==========================================
+ Hits 22233 22247 +14
- Misses 10159 10188 +29
- Partials 2000 2005 +5
Continue to review full report at Codecov.
|
|
@ruflin, I was expecting the same thing before starting working on this issue. But there I didn't found any common configuration object between monitors, that's why I added the |
|
I wast thinking perhaps somewhere around BTW: This should also be added to the docs under the common config options: https://github.com/elastic/beats/blob/master/heartbeat/docs/reference/configuration/heartbeat-options.asciidoc |
|
The common configurations for monitors are currently 'implicit' in code (no special type), as originally I have had only one field to load from: See here With us adding more fields, this should become it's own type. All settings are added to MonitorTask. Not sure, but I think I didn't touch any of this code yet, as we were planning to redo the reloading functionality, to resemble filebeat/metricbeat conf.d support. |
|
@urso Thanks for those explanation. I'm going to do what you said and I will push that up. |
|
Can one of the admins verify this patch? |
|
I finally got time to work on this. Thanks @urso, your solution is way muck cleaner. |
|
@glefloch For the |
|
@tsg thanks, I ran make check and fixed code format. |
5cd9516 to
70e97b6
Compare
urso
left a comment
There was a problem hiding this comment.
Code change looks quite clean, but I left you 2 minor comments.
Great you also added an integration test. Much appreciated. But checking travis, the test seem to have failed. Any idea why?
heartbeat/beater/manager.go
Outdated
There was a problem hiding this comment.
the name never changes. we can move this line before returning the func and execute the check only once instead of per event/run...
There was a problem hiding this comment.
You are right, I move it on top of the return
heartbeat/beater/manager.go
Outdated
There was a problem hiding this comment.
we really want to stop the job by returning here? How 'fatal' is an error when adding fields? e.g. we still want to try to report the original event if this op failed? MergeFields only errors if some field can not be spliced into, because some supposed to be intermediate object is an actual leaf/primitive value.
Normall If len(next) > 0, more followup tasks will be executed to finish the final job. We want to kill the job on 'naming' conflicts in MergeFields?
There was a problem hiding this comment.
Well, you right, should we also ignore errors on while add tags?
|
Thanks for the review @urso, I'm going to fix your comments and check the test as well. |
|
@glefloch Travis complains about the latest version. Is that test passing locally for you? |
|
@tsg actually, when I run |
|
@tsg, heartbeat testsuite is ok, but filebeat testsuite got broken because of a timeout with elasticsearch... There is also a weird error with the heartbeat testsuite using |
|
@tsg, I rebase master and all check are ok. Can you check this PR again? |
|
Merged. Thanks for you patience and time getting this change in. |
|
You're welcome that was a pleasure to implement this feature. |
|
Removing need_docs tag. Docs were added in #4753 |
Add Tags and fields attribute to monitor configuration.
Close #3623