fix(flask): wrap wsgi_app call in try/except to prevent active_requests gauge leak (#4433)
* fix(flask): wrap wsgi_app call in try/except to prevent active_requests gauge leak If wsgi_app() raises an uncaught exception, the active_requests_counter decrement at the end of _wrapped_app was never reached, causing the gauge to permanently read high. Kubernetes HPA and similar systems would see phantom load. Add a bare try/except that decrements the counter and re-raises on exception, matching the pattern already used in the WSGI instrumentation. Fixes #4431 Signed-off-by: alliasgher <alliasgher123@gmail.com> * fix(flask): use try/finally for active_requests decrement per review Signed-off-by: alliasgher <alliasgher123@gmail.com> * fix(flask): add regression test for active_requests gauge leak on error Signed-off-by: alliasgher <alliasgher123@gmail.com> * chore: add CHANGELOG entry for #4433 Signed-off-by: Ali <alliasgher123@gmail.com> * test: flatten nested blocks to satisfy pylint R1702 Signed-off-by: Ali <alliasgher123@gmail.com> * chore: fix 5 pre-existing broken links in CHANGELOG.md The check-links workflow fails on any PR that touches CHANGELOG.md because the full file is scanned and five historical entries contain broken URLs: - #1670 and #227 entries have a stray `]` inside the URL. - The #1033 entry is missing the `/` between the org and repo in the URL. - The `aws.ecs.*` spec link points to the old path in opentelemetry-specification; the content has since moved to the semantic-conventions repo. - The 1.12.0rc2-0.32b0 release tag does not exist on opentelemetry-python; drop the link, keep the heading text. Signed-off-by: Ali <alliasgher123@gmail.com> * style: apply ruff format to flask regression test Signed-off-by: Ali <alliasgher123@gmail.com> * chore: drop unrelated CHANGELOG cleanup from this PR Per @MikeGoldsmith's review, the changelog broken-link cleanup that was folded into this branch via bb17ad0 should not be mixed with the flask fix. Reset CHANGELOG.md to upstream/main and re-add only this PR's entry. Most of the broken links from bb17ad0 have already been fixed on main independently, so no separate cleanup PR is needed. Signed-off-by: Ali <alliasgher123@gmail.com> * add changelog Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com> --------- Signed-off-by: alliasgher <alliasgher123@gmail.com> Signed-off-by: Ali <alliasgher123@gmail.com> Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com> Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>
A
Ali Asghar committed
54c39f97ad40e7474307a1dc6a58b98901292feb
Parent: df62ee6
Committed by GitHub <noreply@github.com>
on 5/22/2026, 2:58:56 PM