Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Xray not capturing stack traces in latest version of Flask

Aperta
#269 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@srprash ci sta già lavorando.

Dal 26/1/2021.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug pending release

The after_request handler is closing the segment before the teardown_request handler is called so the stack trace isn't captured.

It looks like this behavior changed as of Flask v1.1.0 (specifically https://github.com/pallets/flask/pull/3266)

Currently using:

  • aws-xray-sdk v2.6.0
  • flask v1.1.2

Here is our current work around:

app = Flask(__name__)

def wrap_exception_handler(handler):
    def wrapped_function(exp):
        if not isinstance(exp, HTTPException) or exp.code >= 500:
            try:
                stack = stacktrace.get_stacktrace(
                    limit=xray_recorder.max_trace_back,
                )

                xray_recorder.current_segment().add_exception(exp, stack)
            except Exception:
                app.logger.error('Failed to add stack trace to xray segment')

        return handler(exp)
    return wrapped_function

app.handle_user_exception = wrap_exception_handler(app.handle_user_exception)
Lingua principale
Python
Stelle
339
Fork
147
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aws/aws-xray-sdk-python

Tutte le issue di aws/aws-xray-sdk-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.