Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP 4xx errors are treated as errors #11635

Open
d33kayyy opened this issue Dec 8, 2024 · 3 comments
Open

HTTP 4xx errors are treated as errors #11635

d33kayyy opened this issue Dec 8, 2024 · 3 comments
Assignees

Comments

@d33kayyy
Copy link

d33kayyy commented Dec 8, 2024

Hi, I recently upgraded my Python application from Python 3.10 to 3.12, hence I had to upgrade ddtrace from 1.20.19 to 2.16.1.

I noticed that now responses with HTTP 4xx are also considered as errors. I checked the documentation and found DD_TRACE_HTTP_SERVER_ERROR_STATUSES. However, I'm not setting it in my project that it should use the default, which must be status between 500-599.

Image

Libraries' versions

django==5.1.3
ddtrace==2.16.1
gunicorn==20.1.0
uvicorn==0.32.0

Running with

ddtrace-run gunicorn -w $HTTP_WORKER_COUNT -k example.asgi.UvicornWorker --bind 0.0.0.0:$PORT example.asgi:application
@wantsui
Copy link
Collaborator

wantsui commented Dec 17, 2024

@d33kayyy In your screenshot, is that issue occurring with the span name/operation name django.request? Or are you seeing it on a different span?

@d33kayyy
Copy link
Author

@wantsui yes it is operation:django.request

@wantsui wantsui self-assigned this Dec 18, 2024
@wantsui
Copy link
Collaborator

wantsui commented Dec 18, 2024

@d33kayyy Thanks for confirming!

Unfortunately, I wasn't able to reproduce this with 2.16.1 with the details that you provided (see my attempt under What I tried). My 404s are correctly marked as "OK" by default.

I can think of a few things that could differentiate your application from my attempt, like:

Is there anything in your application that might be doing anything like that?

Note: In case there are details about the application that you may not want to write out in a public thread, you can also open a support ticket with us through any of these options listed here: https://docs.datadoghq.com/help/ . If you reference this Github issue, the support engineer will be able to associate this Github issue with the support ticket and we can keep troubleshooting from there too.

What I tried
I tried reproducing this with the versions listed and a basic application configured with Django ie: (https://docs.djangoproject.com/en/5.1/intro/tutorial01/), running over gunicorn, ie: ddtrace-run gunicorn helloworld.wsgi --bind 0.0.0.0 .

When I send a request to an endpoint that doesn't exist, my 404 request correctly shows up under the OK status, ie:

Image

And in debug mode, I can see that the error is marked as 0 (for an "OK" status)

finishing span name='django.request' id= trace_id= parent_id=None service='djangoapp' resource='GET 404' type='web' start= end= duration=0.005796417 error=0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants