aws / aws-xray-sdk-go

AWS X-Ray SDK for the Go programming language.
Apache License 2.0
276 stars 117 forks source link

Make handler.httpTrace publicly visible (handler.HttpTrace) #328

Open pm98zz-c opened 2 years ago

pm98zz-c commented 2 years ago

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):

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?

willarmiros commented 2 years ago

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.