Http transaction is success although error

I have a simple web transaction using fast api to test APM. The code is the following:

app.get("/critical", status_code=500)
def critcal_failure():
        print("Doing something critical")
        raise Exception("something went wrong")
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"{e}")

I would expect this to have the "events.outcome" field set to failure. Instead I see it to be "success". Am I missing something?
ELK stack version is 7.17.9

Hi @avlachopoulos

I copied your example code verbatim (except for adding the missing @ in front of app), and outcome is set to failure as expected.

Could you share the output of pip freeze? Maybe it's a version problem.

Also, note that your handling of the exception and calling capture_exception isn't necessary, the agent should capture unhandled exceptions automatically.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.