Skip to content
Snippets Groups Projects
Commit 1a1da89f authored by Feanil Patel's avatar Feanil Patel
Browse files

Drop setting attributes for the size of each cookie.

Setting a new metric per cookie name resulted in a lot of metrics
getting added to New Relic.  In some cases, this was causing other
more important metrics to not get registered.
parent 1ae50fc4
No related merge requests found
......@@ -152,11 +152,8 @@ class CookieMonitoringMiddleware(MiddlewareMixin):
max_group_cookie_name = max_cookie_name
max_group_cookie_size = max_cookie_size
for name, size in cookie_names_to_size.items():
attribute_name = 'cookies.{}.size'.format(name)
set_custom_attribute(attribute_name, size)
log.debug(u'%s = %d', attribute_name, size)
# Only log the groups because adding an arbitrary number of individual cookies pushes too many
# metrics into NR and results in other metrics getting dropped potentially.
for name, size in cookie_groups_to_size.items():
attribute_name = 'cookies.{}.group.size'.format(name)
set_custom_attribute(attribute_name, size)
......
......@@ -114,14 +114,6 @@ class RequestUtilTestCase(unittest.TestCase):
middleware.process_request(mock_request)
mock_set_custom_attribute.assert_has_calls([
call('cookies.a.size', 100),
call('cookies._b.size', 13),
call('cookies._c_.size', 13),
call('cookies.a.b.size', 10),
call('cookies.a.c.size', 10),
call('cookies.b..size', 13),
call('cookies.b_a.size', 15),
call('cookies.b_c.size', 15),
call('cookies.a.group.size', 20),
call('cookies.b.group.size', 43),
call('cookies.max.name', 'a'),
......@@ -149,9 +141,6 @@ class RequestUtilTestCase(unittest.TestCase):
middleware.process_request(mock_request)
mock_set_custom_attribute.assert_has_calls([
call('cookies.a.size', 10),
call('cookies.b_a.size', 15),
call('cookies.b_c.size', 20),
call('cookies.b.group.size', 35),
call('cookies.max.name', 'b_c'),
call('cookies.max.size', 20),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment