-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Allow tag aliases for wmi tag_by and tag_queries parameters
#21792
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files🚀 New features to boost your workflow:
|
91650cb to
ea5fe72
Compare
|
The following files, which will be shipped with the agent, were modified in this PR and You can ignore this if you are sure the changes in this PR do not require QA. Otherwise, consider removing the label. List of modified files that will be shipped with the agent |
| t_split = t.split(' as ') | ||
| t = t_split[0].strip() | ||
| alias = t_split[1].strip() |
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.
What alias will look like for foo as expression? Will it have even [1]? Meaning will not it crash?
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.
Also should it be done in initialization instead of on every check run to parse it again and again?
It looks even worse, the same value is or could be parsed more than once in the function because it is done in the loop.
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.
What alias will look like for foo as expression? Will it have even [1]? Meaning will not it crash?
@iglendd
I hadn't considered that, but I'd imagine the agent would try to submit a tag with an empty key which wouldn't be ideal. In a case like this we can either:
- have the integration throw an error to let users know of the incomplete aliasing
OR - have it throw a warning and just use the original property name for the time being.
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.
right, my worry was more that it would derail config/check code and exit prematurely or even crash
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.
Understandable, I added some conditions where if the alias is empty, the check will use the property name and log a warning to let users know of the missing alias.
What does this PR do?
This PR adds additional functionality to the
tag_byandtag_queriesparameters. Users can add aliases to tags collected from the properties defined in these parameters.in
tag_byusers can define aliases by addingAS <Alias>to the property in the list:In
tag_queries, users can add an entry to the list for the alias:Motivation
https://datadoghq.atlassian.net/browse/WINA-1928
Review checklist (to be filled by reviewers)
qa/skip-qalabel if the PR doesn't need to be tested during QA.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged