add tracing for handler chain #7908
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR targets localstack developers and adds tracing functionality to debug the handler chain.
I think this can be useful for work that involves a lot of debugging in the HTTP framework (thinking APIGW, S3, CORS, Lambda, issues with request streaming, ...) 👀 @bentsku @alexrashed @calvernaz @dfangl @dominikschubert
You can enable this behavior by setting
DEBUG_HANDLER_CHAIN=1
By wrapping handlers and recording before/after state of the context, request, and response object, we can report in quite a detailed way what the handler did to the request/response.
This includes
I'm sure there are better/more generic ways of implementing it than the way I did, but I feel for a first iteration it's OK.
Here are some examples of how the report looks like. I know they're not super pretty - happy for suggestions.
calling a non-implemented operation:
calling
awslocal opensearch list-domain-names
calling the health endpoint