-
Notifications
You must be signed in to change notification settings - Fork 260
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
Adding support for list of datadog tags in v6 configuration file #557
Conversation
db06e76
to
71ab1cf
Compare
Any estimate on when this might get merged? |
Hey @skarlupka , thank you for your contribution! Before merging your pull-request I would like to add some commits to have the exact same behavior between Agent 5 and Agent 6 (the list of tags injected in the Agent 5 configuration is working but not 100% correct). Could I ask you to tick the box letting me to push commits in your PR? Thank you. |
Hello @remeh! The "Allow edits from maintainers" is checked in the PR. Let me know if there is anything else I need to do. |
They were previously written as their string representation, meaning an array containg "custom:tag1" and "custom:tag2" would have created the tag `["custom:tag1"` and `"custom:tag2"]`. It was working correctly because the Datadog servers were cleaning those extra chars.
Thank you @skarlupka I've added a condition to correctly handle array of tags in the Agent 5 configuration + I've slighty changed your PR to stay with |
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 👍
Could you also update the attribute documentation here?
chef-datadog/attributes/default.rb
Lines 96 to 101 in 45e0097
# This can be a string of comma separated tags or a hash in this format: | |
# default['datadog']['tags'] = { 'datacenter' => 'us-east' } | |
# Thie above outputs a string: 'datacenter:us-east' | |
# When using the Datadog Chef Handler, tags are set on the node with preset prefixes: | |
# `env:node.chef_environment`, `role:node.node.run_list.role`, `tag:somecheftag` | |
default['datadog']['tags'] = '' |
As we discussed offline a list on node['datadog']['tags']
wasn't supported officially by the cookbook, but did work on Agent 5, even though it wasn't by design: the INI format of Agent 5 doesn't support non-scalar values like lists, so for a config like:
tags: ["foo:bar", "bar:baz"]
Agent 5 sends the tags ["foo:bar"
and "bar:baz"]
, but the Datadog backend then cleans up the characters that aren't allowed in tags so that foo:bar
and bar:baz
are indeed applied as tags to the host.
Thanks again for your contribution @skarlupka! @tschroeder-zendesk I'm merging this to master now and it'll be part of release |
Fixes #556