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

normalize HTTP status code in transaction.result #85

Conversation

beniwohli
Copy link
Contributor

This normalizes the status code into status classes 2xx, 3xx, 4xx and 5xx.
The unmodified status code is still available in context.response.status_code

@beniwohli beniwohli force-pushed the feature/http-transaction-result-normalization branch from 585144d to 7b0e553 Compare November 2, 2017 14:40
assert resp.status_code == 0, resp.response

transactions = flask_apm_client.client.instrumentation_store.get_all()
assert transactions[0]['result'] == '0 fail' # "0" is prepended by Werkzeug BaseResponse
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that every transaction.result not coming from a flask or django app has a 0 prefix no matter what? Could you get rid of this somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly. It means that if a flask user returns a non-integer HTTP status code (which is all kinds of wrong in the first place), flask will prepend this 0 to it. Not sure why, but I'm not hugely concerned about it, since it only happens when the user code doing something completely wrong

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes, it is a flask test.. then I am with you to not worry about this too much.

@beniwohli beniwohli force-pushed the feature/http-transaction-result-normalization branch 2 times, most recently from a3660e4 to dad4ff7 Compare November 13, 2017 12:47
This normalizes the status code into status classes 2xx, 3xx, 4xx and 5xx.
The unmodified status code is still available in context.response.status_code
@beniwohli beniwohli force-pushed the feature/http-transaction-result-normalization branch from dad4ff7 to fffce0b Compare November 13, 2017 15:19
@beniwohli beniwohli closed this in 4207f30 Nov 13, 2017
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.

None yet

2 participants