Fix multi-instance service discovery#3341
Conversation
|
@hkaj Do you think we could setup this one for 5.14? |
b672387 to
dbc59a0
Compare
|
Note: I've got this running in one of my environments. Works fine with a multi-instance declared via an annotation. |
dbc59a0 to
cfcccb7
Compare
|
Note: this will also require a fix for the page https://docs.datadoghq.com/guides/autodiscovery/ |
|
Hi @hkaj do you think we can plan that one for 5.14? |
hkaj
left a comment
There was a problem hiding this comment.
Hi @aerostitch !
Thanks for the PR. It's an interesting feature. The freeze for 5.14 is tomorrow so it's likely going to be pushed to 5.15 though.
I left one comment, let me know what you think. Also merge conflicts need to be fixed. We'll take care of the documentation.
Thanks again!
| if tpl and len(tpl) == 2: | ||
| init_config, instance = tpl | ||
| result_instances.append(instance) | ||
| result_init_config.update(init_config) |
There was a problem hiding this comment.
I think we should rather apply the same logic as here: https://github.com/DataDog/dd-agent/pull/3341/files#diff-8437fe4d4416c056af154d55fb2993c2R372
You can do something like
if not result_init_config:
result_init_config = init_config
elif result_init_config != init_config:
self.log.warning("Different versions of `init_config` found for "
"check {}. Keeping the first one found.".format('check_name'))This will avoid unclear errors in case init_configs diverge and values are overriden by later ones. Not sure if it can happen right now but that silent update makes me nervous. Or do you see a legit use case for it?
cfcccb7 to
03a3a9b
Compare
03a3a9b to
3a78899
Compare
|
Makes sense @hkaj for the requested change. I rebased & updated the PR waiting for travis to start the build for about 1h now. |
|
Thanks, LGTM. Will merge once 5.14.x is branched off. It's more of a feature because it was explicitly designed for a single instance and that was the only configuration that was supported. Moved it to 5.14.1. |
|
Thanks a lot! :) |
Fixes: #3340
As explained in #3340, having multiple instances for the same check in the annotations don't work well.
This brings the few adjustments to make it work.
The doc will need to be updated to say that if you want several instances of the same check in the annotations, you'll need to have an array for then inside the annotations array.