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

Add easier namespacing for data submission #3718

Merged
merged 2 commits into from
May 6, 2019
Merged

Add easier namespacing for data submission #3718

merged 2 commits into from
May 6, 2019

Conversation

ofek
Copy link
Contributor

@ofek ofek commented May 6, 2019

Motivation

Remove the need to perform string formatting throughout every check, see for example

self.gauge(self.m('application.active'), db['appls_cur_cons'], tags=self._tags)

I'll be using this for the integration I'm currently working on

@codecov
Copy link

codecov bot commented May 6, 2019

Codecov Report

Merging #3718 into master will decrease coverage by 2.4%.
The diff coverage is 100%.

@@            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

Copy link
Contributor

@masci masci left a 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

Copy link
Member

@truthbk truthbk left a 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__)
Copy link
Member

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__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@ofek ofek merged commit b33d7ff into master May 6, 2019
@ofek ofek deleted the ofek/n branch May 6, 2019 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants