-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[autodiscovery] Add ignore_autodiscovery_tags
config parameter
#4521
Conversation
releasenotes/notes/autodiscovery-add-ignore_listener_tags-parameter-9968246cdad12bed.yaml
Outdated
Show resolved
Hide resolved
In some cases, a check should not receive tags coming from the autodiscovery listeners. By default `ignore_listener_tags` is set to false which doesn't change the behavior of the checks. The first check that will use it is `kubernetes_state`.
2984786
to
6788551
Compare
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.
Left a comment, otherwise LGTM!
tags, err := svc.GetTags() | ||
if err != nil { | ||
return resolvedConfig, err | ||
tags := []string{} |
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.
Instead of having a slice later processed which could be empty in some cases, it may have been cleaner to have:
for i := 0; i < len(resolvedConfig.Instances); i++ {
err = resolvedConfig.Instances[i].MergeAdditionalTags(tags)
if err != nil {
return resolvedConfig, err
}
}
runned only if !tpl.IgnoreListenerTags
(moving the svc.GetTags()
also there obv).
Something like:
if !tpl.IgnoreListenerTags {
tags, err = svc.GetTags()
if err != nil {
return resolvedConfig, err
}
for i := 0; i < len(resolvedConfig.Instances); i++ {
err = resolvedConfig.Instances[i].MergeAdditionalTags(tags)
if err != nil {
return resolvedConfig, err
}
}
}
This way, all the logic around tags is in the same block in this function. 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.
good idea
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.
@remeh let me know if you are ok with my change.
e55c0f6
to
ff0019f
Compare
ff0019f
to
9f0ac49
Compare
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!
ignore_listener_tags
config parameterignore_autodiscovery_tags
config parameter
Co-Authored-By: Haïssam Kaj <hkaj@users.noreply.github.com>
What does this PR do?
Add
ignore_autodiscovery_tags
config parameter.Motivation
In some cases, a check should not receive tags coming from the autodiscovery listeners.
By default
ignore_autodiscovery_tags
is set to false which didn't change the behavior of the checks.The first check that will use it is
kubernetes_state
.Additional Notes
link to this pr: DataDog/integrations-core#5105