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

Fix bug where tags list increases in size #94

Merged
merged 1 commit into from
Nov 3, 2015

Conversation

steven-liu
Copy link
Contributor

Summary

When previously-defined metric-level tags (non-literal list) are passed into the gauge() function,
the metric-level tag list will be modified if constant_tags is not None. This is due
to the += operator modifying the metric-level list by appending
the list constant_tags.

If you're using dogstatsd to send your metrics, this will inevitably lead to a error: [Errno 90] Message too long since the UDP packet size has an upper limit.

For an example of this, see the new test, test_gauge_constant_tags_with_metric_level_tags_twice.

Fix

Use the following instead of +=:

# WILL modify metric-level tags passed into the function
tags += self.constant_tags

# WON'T modify metric-level tags passed into the function
tags = tags + self.constant_tags

When a previously defined tag list is passed into the gauge() function,
the tag list will be modified if constant_tags is not None. This is due
to the '+=' operator modifying the passed-in tag list by appending
constant_tags.
@KyleJamesWalker
Copy link

+1

@yannmh
Copy link
Member

yannmh commented Nov 3, 2015

Thanks for the fix @steven-liu !

yannmh added a commit that referenced this pull request Nov 3, 2015
Fix bug where tags list increases in size
@yannmh yannmh merged commit b5f7d6d into DataDog:master Nov 3, 2015
@yannmh yannmh added this to the 0.11.0 milestone Jan 8, 2016
yannmh added a commit that referenced this pull request Mar 1, 2016
Do not modify metric-level `tags` parameters when `constant_tags` is
set.
Similar to #94.
yannmh added a commit that referenced this pull request Mar 1, 2016
Do not modify metric/event-level `tags` parameters when `constant_tags`
is set.
Similar to #94.
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

Successfully merging this pull request may close these issues.

3 participants