aws-xray-sdk-go
aws-xray-sdk-go copied to clipboard
Make handler.httpTrace publicly visible (handler.HttpTrace)
Looking at the number of issues that are around supporting more use cases (routers, frameworks, etc), looks like a lot could be solved by being able to call HttpTrace directly and not wrap it in Handler. It would probably solve a lot of the integrations issues quite easily, pending more sophisticated ways.
My use case (just an example amongst others):
- gorillamux as router
- lambda behind an ALB (I use a custom adapter, but basically the same as https://github.com/akrylysov/algnhsa, because https://github.com/awslabs/aws-lambda-go-api-proxy does not support ALB at the moment)
The problem there, is I "forge" the http.ResponseWriter and http.Request from the lambda event, and thus need to pass them directly into ServeHTTP (or through httpTrace) and can't inject directly.
I hope it makes sense?
Hi @pm98zz-c,
Thanks for this write up, I think it is a valid proposal and we area always open to pull requests!
Also, The AWS Distro for OpenTelemetry for tracing was just made generally available last week and includes support for Go. The upstream OpenTelemetry Go project supports instrumentation for several libraries including gorillamux. You can give that a look by visiting our getting started guide.