-
Notifications
You must be signed in to change notification settings - Fork 292
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 400 Bad Request being marked as a false positive server error in Keycloak #7288
Comments
Hello, thank you for the report. I see from the screenshot that you are using error tracking, you can mark the issue as "Ignored" if you don't want to see it in the issues list. |
Since from the HTTP client perspective the response is a HTTP 400 and not HTTP 5xx, I was expecting Datadog to not mark this as an error.
I missed that. I am going to try it now. |
The thing is that where the error is captured, we just see it as an exception being thrown by a Java service, which we record as an error. We don't have information on the HTTP response code at this point in time. When we handle the actual response code, we see it's a 400 and we do not mark that span as error. I know it's not your code but an open source project, but maybe the issue is that keycloak is using an Exception to handle code flow in a not-so-exceptional situation, which is something regarded as bad practice when writing Java code. |
Ok. In that case, perhaps a new config similar to DD_TRACE_CLASSES_EXCLUDE and DD_HTTP_SERVER_ERROR_STATUSES to ignore specific exceptions (DD_TRACE_EXCEPTIONS_EXCLUDE)? |
Or even better let us define some Java class that can decide if a specific exception should be regarded as an error or not i.e. by looking into the type, attributes or annotations. This would also allow for a fix for #7141. |
Java web frameworks encourage throwing Exceptions from an endpoint method whenever it cannot return a thing of the type it usually returns. The pattern is:
When Datadog traces this method, it has to make some kind of decision about whether the Exception is "4xx-like" or "5xx-like". Perhaps it needs to know the framework and its exception handling conventions to decide that. Or perhaps it can defer the decision until the enclosing http span knows the http status code. Anyway, this pattern is not only valid but normal. Datadog cannot know about arbitrary methods of course. But if Datadog auto-detects e.g. JAX-RS methods like this and says it can trace them, it seems to imply that Datadog wants to find a way to interpret exceptions thrown from it, just like it interprets what the web server is doing when it is setting a status code. (Currently this isn't working, and I think it used to work somehow, but I can't be sure of course.) Maybe fits better in #7141 but I think it may be the same issue. |
Running keycloak:
make a HTTP request to token endpoint with an expired or invalid refresh token
We initially though this was a problem in Keycloak keycloak/keycloak#29451 fixed by keycloak/keycloak#29649 but now it seems to be a problem in dd-java-agent.
The text was updated successfully, but these errors were encountered: