-
Notifications
You must be signed in to change notification settings - Fork 1
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
NH-52515 Remove cached custom name at calculate_custom #187
NH-52515 Remove cached custom name at calculate_custom #187
Conversation
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.
Can you add a test to confirm this behavior?
Added in 1d7445f. Going to keep going on this PR to add tests for other processor functions! |
Thanks @swi-jared ! Lots more unit tests now. Please could you have a look when you have a moment. |
mocker.Mock(), | ||
mocker.Mock(), | ||
) | ||
result = processor.calculate_transaction_names(mock_span) |
Check notice
Code scanning / CodeQL
Unused local variable
mocker.Mock(), | ||
mocker.Mock(), | ||
) | ||
result = processor.calculate_transaction_names(mock_span) |
Check notice
Code scanning / CodeQL
Unused local variable
mocker.Mock(), | ||
mocker.Mock(), | ||
) | ||
result = processor.calculate_transaction_names(mock_span) |
Check notice
Code scanning / CodeQL
Unused local variable
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.
I didn't originally mean for you to do all this extra work! Well done! 🥇
EDIT: Also adds several unit tests for inbound metrics processor.
Adds removal of any stored custom transaction name at the end of
calculate_custom_transaction_name
. It will only be re-added to the manager if span is sampled so that exporter will have access to the name, before removing name again after reporting. This is to stop leaking in the case where span is not sampled but custom transaction name is set (used for inbound metrics reporting). Big thanks to @swi-jared for seeing this!Step-wise:
set_transaction_name("foo")
. Call is successful and manager stores"<trace_id>-<span_id>": "foo"
.<span_id>
andon_end
of processors called for all recorded spans, sampled or not (already in place!)calculate_transaction_names
for inbound metrics is called. Helpercalculate_custom_transaction_name
gets"<trace_id>-<span_id>": "foo"
from manager.calculate_custom_transaction_name
deletes"<trace_id>-<span_id>": "foo"
from manager.on_end
."<trace_id>-<span_id>": "foo"
in manager. This can be a re-cache of custom name or new cache of 'regular' transaction name.a. Exporter gets
"<trace_id>-<span_id>": "foo"
from manager.b. Exporter deletes
"<trace_id>-<span_id>": "foo"
from manager.Test trace from Django A testbed app's "reentry" route that requests its own route and also uses API set_transaction_name --
sw.transaction
iscustom-name-django-a-root
at the root span, and iscustom-name-reentry
at theSERVER:GET another/
span. Just a quick smoke test to make sure custom txn naming still works: https://my.na-01.cloud.solarwinds.com/140638900734749696/traces/E51FD08B882DA4677B26254C08F5701A/E5C99F94B8B0D44A/details/breakdown?perspective=requests&serviceId=e-1540126275982954496I made a second request a few minutes later with APM Python hardcoded to always decide
RECORD_ONLY
. This is to make sure we get metrics blips for the same custom names even if no trace exported: