Skip to content
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

[BUG] default tag prefix tag: #932

Open
rjhornsby opened this issue Sep 17, 2024 · 0 comments
Open

[BUG] default tag prefix tag: #932

rjhornsby opened this issue Sep 17, 2024 · 0 comments

Comments

@rjhornsby
Copy link

Environment details (Operating System, Cloud provider, etc):

Rocky 9 Linux, AWS but not specifically relevant.

Describe what happened:

I'm not sure if this is a bug or just an unusual default behavior with maybe unintended consequences.

When asking Chef to tag a node, the default behavior for the chef-datadog cookbook is to prefix this tag with tag: before it is submitted to DD. A tag like chef-version:1.0.0 turns into tag:chef-version:1.0.0 when it reaches DD.

This causes issues searching and filtering hosts in DD by tag (concept), because the tag key is the string literal tag, while the value of the tag is chef-version:1.0.0. For example, when you tell DD you want to group by a tag key, what you get in the dropdown list is tag, not chef-version.

This UI behavior makes sense if the tag is split by the first : separator into key and value, which is how one would expect the split to happen.

Describe what you expected:

It's clear from attributes/default.rb that I can override this behavior. What's less clear is why this prefix is the default? I feel like I'm missing something obvious about the benefit of leaving the behavior as is.

Is there a downside or a hidden gotcha to setting the prefix to empty string?

Steps to reproduce the issue:

Set a tag on your node, for example in a recipe:

version_tag = "chef-version:#{node['chef_packages']['chef']['version']}"
tag(version_tag) unless tagged?(version_tag)

As per the behavior described in the attributes file, this will be prefixed by tag:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant