-
Notifications
You must be signed in to change notification settings - Fork 562
feat: Option to not trace HTTP requests based on status codes #4869
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
feat: Option to not trace HTTP requests based on status codes #4869
Conversation
❌ 78 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
One more thing -- we should also record the dropped transaction in a client report. Check |
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.
One last thing, otherwise looks great!
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.
🚀
Description
Add
trace_ignore_status_codes
option to exclude HTTP requests from tracing if they have certain status codes. A debug-level log message is printed if a transaction is dropped because its status code is ignored. By default no status codes automatically cause transactions to be dropped, although this will change in the next major.Issues
Closes #4812
Reminders
tox -e linters
.feat:
,fix:
,ref:
,meta:
)Note
Adds a configurable option to skip tracing transactions when HTTP response status matches specified codes or ranges, with logging and tests.
Transaction._in_http_status_code_range()
and use it inTransaction.finish()
to setsampled=False
whendata['http.response.status_code']
matchesclient.options['trace_ignore_status_codes']
; warn on non-int status types; log debug when discarded._get_log_representation()
and reuse in sampling logs.trace_ignore_status_codes
init option and document it inClientConstructor.__init__
docstring.tests/tracing/test_ignore_status_codes.py
covering single codes, ranges, mixed lists, malformed config, invalid status type, and default behavior.Written by Cursor Bugbot for commit ed08547. This will update automatically on new commits. Configure here.