-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fixed decoding warning for None tags #3249
Conversation
continue | ||
|
||
normalized_tags.append(tag) | ||
if not tag: |
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.
since we expect None
tags, let's explicitly do if tag is None: continue
and leave the rest of the code unchanged
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.
✅
tags = [None, 'tag:foo'] | ||
|
||
normalized_tags = check._normalize_tags_type(tags, None) | ||
assert len(normalized_tags) == 1 |
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.
let's test the contents, not the length
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.
✅ thanks!
Codecov Report
@@ Coverage Diff @@
## master #3249 +/- ##
==========================================
- Coverage 85.18% 75.98% -9.21%
==========================================
Files 690 54 -636
Lines 36813 3964 -32849
Branches 4469 504 -3965
==========================================
- Hits 31360 3012 -28348
+ Misses 4204 832 -3372
+ Partials 1249 120 -1129 |
Added a follow-up PR to have the same fix but for the python2 check base class: #3665 |
What does this PR do?
If an integration tries to send a metric with tag set to
None
, there will be a warning thrown by this code: https://github.com/DataDog/integrations-core/blob/master/datadog_checks_base/datadog_checks/base/checks/base.py#L352-L363As we cannot decode it.
Now, we simply ignore if a tag is set to None.
Motivation
Customer which had his logs spammed by this warning, because of a label missing in a prometheus payload.
Review checklist (to be filled by reviewers)
changelog/
andintegration/
labels attached