hypertrace / javaagent

Hypertrace OpenTelemetry Java agent with payload/body and headers data capture.
Apache License 2.0
28 stars 14 forks source link

Catch our blocking exception when it is nested. Eg. spring framework. #373

Closed tyroneyu closed 1 year ago

tyroneyu commented 1 year ago

Description

Please include a summary of the change, motivation and context.

When a filter blocks a request (eg. traceable filter), the http code returned is 500. It should be 403. The happens when the exception that we throw is nested and we are not catching it properly. This can be produced when used the spring framework as an app.

Testing

Manual tested with a spring framework app

Checklist:

tyroneyu commented 1 year ago

Nice! While we are at it, can we add this loop at other places where we are catching this exception as well?

I only see one spot where we "catch" this exception. The other areas just check and rethrow the exception. In those try blocks, they all call ByeBufferSpanPair.captureBody and that is where the exception is thrown.

tyroneyu commented 1 year ago

I'm going to merge this and open a new jira to track the snyk error work. I think it's a bigger/wider ranging effort.