Skip to content

Commit e48d34e

Browse files
authored
Expand limit for custom attributes to 128. (#144) (#145)
* Expand limit for custom attributes to 128. #144 * Fix failing pika tests. #144
1 parent b018dd8 commit e48d34e

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

newrelic/core/attribute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
'peer.address',
7474
))
7575

76-
MAX_NUM_USER_ATTRIBUTES = 64
76+
MAX_NUM_USER_ATTRIBUTES = 128
7777
MAX_ATTRIBUTE_LENGTH = 255
7878
MAX_64_BIT_INT = 2 ** 63 - 1
7979

tests/agent_features/test_attribute.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,17 +299,17 @@ def test_custom_params_value_too_long():
299299
assert result
300300

301301

302-
_required_custom_params_too_many = [('key-63', 'value')]
303-
_forgone_custom_params_too_many = [('key-64', 'value')]
302+
_required_custom_params_too_many = [('key-127', 'value')]
303+
_forgone_custom_params_too_many = [('key-128', 'value')]
304304

305305

306306
@validate_custom_parameters(_required_custom_params_too_many,
307307
_forgone_custom_params_too_many)
308308
@background_task()
309309
def test_custom_param_too_many():
310-
for i in range(65):
310+
for i in range(129):
311311
result = add_custom_parameter('key-%02d' % i, 'value')
312-
if i < 64:
312+
if i < 128:
313313
assert result
314314
else:
315315
assert not result # Last one fails
@@ -319,7 +319,7 @@ def test_custom_param_too_many():
319319
_forgone_custom_params_too_many)
320320
@background_task()
321321
def test_custom_params_too_many():
322-
item_list = [('key-%02d' % i, 'value') for i in range(65)]
322+
item_list = [('key-%02d' % i, 'value') for i in range(129)]
323323
result = add_custom_parameters(item_list)
324324
assert not result
325325

tests/agent_features/test_span_events.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -529,13 +529,13 @@ def test_span_custom_attribute_limit():
529529
txn_custom_attrs = []
530530
unexpected_txn_attrs = []
531531

532-
for i in range(64):
533-
if i < 32:
532+
for i in range(128):
533+
if i < 64:
534534
span_custom_attrs.append('span_attr%i' % i)
535535
txn_custom_attrs.append('txn_attr%i' % i)
536536

537537
unexpected_txn_attrs.extend(span_custom_attrs)
538-
span_custom_attrs.extend(txn_custom_attrs[:32])
538+
span_custom_attrs.extend(txn_custom_attrs[:64])
539539
expected_txn_attrs = {'user': txn_custom_attrs, 'agent': [],
540540
'intrinsic': []}
541541
expected_absent_txn_attrs = {'agent': [],
@@ -547,15 +547,15 @@ def test_span_custom_attribute_limit():
547547
expected_absent_txn_attrs)
548548
@validate_span_events(count=1,
549549
expected_users=span_custom_attrs,
550-
unexpected_users=txn_custom_attrs[32:])
550+
unexpected_users=txn_custom_attrs[64:])
551551
@dt_enabled
552552
@background_task(name='test_span_attribute_limit')
553553
def _test():
554554
transaction = current_transaction()
555555

556-
for i in range(64):
556+
for i in range(128):
557557
transaction.add_custom_parameter('txn_attr%i' % i, 'txnValue')
558-
if i < 32:
558+
if i < 64:
559559
add_custom_span_attribute('span_attr%i' % i, 'spanValue')
560560
_test()
561561

tox.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ envlist =
122122
python-framework_starlette-{py36,py37,py38,py39,pypy3},
123123
libcurl-framework_tornado-{py36,py37,py38,py39,pypy3}-tornado0600,
124124
libcurl-framework_tornado-{py36,py37,py38,py39,pypy3}-tornadomaster,
125-
rabbitmq-messagebroker_pika-{py27,py36,py37,py38,py39}-pika{0.13,1.1},
126-
rabbitmq-messagebroker_pika-{pypy}-pika1.1,
125+
rabbitmq-messagebroker_pika-{py27,py36,py37,py38,py39,pypy,pypy3}-pika{0.13,latest},
127126
python-template_mako-{py27,py36,py37,py38,py39}
128127

129128
[pytest]
@@ -250,8 +249,9 @@ deps =
250249
framework_tornado-tornadomaster: https://github.com/tornadoweb/tornado/archive/master.zip
251250
framework-tornado: pycurl
252251
messagebroker_pika-pika0.13: pika<0.14
253-
messagebroker_pika-pika1.1: pika
252+
messagebroker_pika-pikalatest: pika
254253
messagebroker_pika: tornado<5
254+
messagebroker_pika-{py27,pypy}: enum34
255255
template_mako: mako<1.2
256256

257257
setenv =

0 commit comments

Comments
 (0)