-
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
Add easier namespacing for data submission #3718
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3718 +/- ##
==========================================
- Coverage 86.49% 84.08% -2.41%
==========================================
Files 727 62 -665
Lines 37544 4732 -32812
Branches 4481 578 -3903
==========================================
- Hits 32474 3979 -28495
+ Misses 3849 632 -3217
+ Partials 1221 121 -1100 |
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.
Makes sense and it's backward compat, LGTM
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.
There's a minor change in behavior if the namespace is set in the events submitted. It's probably innocuous, but was just worth considering.
if event.get('tags'): | ||
event['tags'] = self._normalize_tags_type(event['tags']) | ||
if event.get('timestamp'): | ||
event['timestamp'] = int(event['timestamp']) | ||
if event.get('aggregation_key'): | ||
event['aggregation_key'] = ensure_unicode(event['aggregation_key']) | ||
|
||
if self.__NAMESPACE__: | ||
event.setdefault('source_type_name', self.__NAMESPACE__) |
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.
This is the only bit that would introduce a change in behavior. I don't really object to it, it's just worth noting.
if event.get('tags'): | ||
event['tags'] = self._normalize_tags_type(event['tags']) | ||
if event.get('timestamp'): | ||
event['timestamp'] = int(event['timestamp']) | ||
if event.get('aggregation_key'): | ||
event['aggregation_key'] = ensure_bytes(event['aggregation_key']) | ||
|
||
if self.__NAMESPACE__: | ||
event.setdefault('source_type_name', self.__NAMESPACE__) |
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.
ditto
Motivation
Remove the need to perform string formatting throughout every check, see for example
integrations-core/ibm_db2/datadog_checks/ibm_db2/ibm_db2.py
Line 85 in d3931ad
I'll be using this for the integration I'm currently working on