opencensus-go icon indicating copy to clipboard operation
opencensus-go copied to clipboard

ochttp: add hooks to enrich request and response attributes

Open julianvmodesto opened this issue 5 years ago • 1 comments

NB: Before opening a feature request against this repo, consider whether the feature should/could be implemented in other the OpenCensus libraries in other languages. If so, please open an issue on opencensus-specs first.

Is your feature request related to a problem? Please describe. I have many http handlers that are chained together in my router, and it's currently easy to add attributes from the request, but it's more difficult to add attributes from the response -- I'd have to span.FromContext in each of my http handlers wherever I'm setting my response.

Describe the solution you'd like It would be wonderful to have a hook to add attributes to the existing ochttp plugin's instrumentation.

Describe alternatives you've considered I think I'd have to redo what ochttp plugin does, and i think implement my own http.RoundTripper.

Additional context N/A

julianvmodesto avatar Dec 28 '18 16:12 julianvmodesto

The use case is I'm using Datadog exporter, and I'd like to set the following error attributes: https://sourcegraph.com/github.com/DataDog/[email protected]/-/blob/ddtrace/ext/tags.go#L44-53

julianvmodesto avatar Dec 28 '18 16:12 julianvmodesto