How to filter sentry messages generated from HTTPException, base on the status code (e.g. not send 422) #10577
-
First Check
Commit to Help
Example Codefrom fastapi import FastAPI
@app.get("/")
def return_id(my_id: int):
return my_id DescriptionProblemWe receive our backend errors on Sentry. However, we would like to filter out the errors that are sent using their status_code. However, the status_code seems to appear nowhere: we checked on Sentry and in the code, and the error events that are formed do not seem to pass this information. Expected behaviorThe event caught by sentry contains a status_code. The error is sent as normal, but as I have the status_code, I can drop the sentry event. Another solution could be to configure from fastAPI what HTTPExceptions are sent to sentry, but we could not find how to achieve this neither. How to reproduce(with sentry configured) Operating SystemmacOS Operating System DetailsNo response FastAPI Version1.103.2 Pydantic Version1.10.13 Python Version3.8.12 Additional Contextsentry_sdk version: 1.32.0 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I am not well versed in sentry's sdk but the docs seem to indicate that you should be able to access the original exception in the What does your |
Beta Was this translation helpful? Give feedback.
I am not well versed in sentry's sdk but the docs seem to indicate that you should be able to access the original exception in the
hint
param which should contain the status codeWhat does your
hint
param look like for a sample request?