Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(wsgi): don't report stopiteration errors [backport 2.9] (#9828)
Backport 99a9dca from #9788 to 2.9. There are several integrations which send StopIteration errors as part of normal operation (say, when we hit the last element of an interable). We are currently flagging such spans as errors, when its expected behavior. After this change, we still generate the spans, but they are no longer reported as errors. Some salient points: * "Errors" on spans are directly tied to UI/Datadog app behaviors and are desired to be actionable by, or at least significant to, the customer. * The wsgi method in this issue is expected to raise StopIteration. Whether or not it is caught, raising an exception is normal behavior for this piece of code. * The StopIteration raised by wsgi may be caught (customer doesn't care and it should not be an error) or not caught (customer does care and it should be an error). We don't know at the time of this span close if the issue is caught or not, so we can't make a 100% informed decision. * Given those points, the decision is to only ignore StopIteration in wsgi explicitly for the method which is expected to raise StopIteration. While the exception may not be caught elsewhere, we are relying on other mechanisms (such as crash detection) to report the issue. Related issue: miguelgrinberg/flask-sock#64 (comment) ## Checklist - [x] The PR description includes an overview of the change - [x] The PR description articulates the motivation for the change - [x] The change includes tests OR the PR description describes a testing strategy - [x] The PR description notes risks associated with the change, if any - [x] Newly-added code is easy to change - [x] The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - [x] The change includes or references documentation updates if necessary - [x] Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Title is accurate - [x] All changes are related to the pull request's stated goal - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - [x] Testing strategy adequately addresses listed risks - [x] Newly-added code is easy to change - [x] Release note makes sense to a user of the library - [x] If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - [x] Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) Co-authored-by: Teague Bick <[email protected]>
- Loading branch information