-
Notifications
You must be signed in to change notification settings - Fork 873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more args to RequestListener #4102
Add more args to RequestListener #4102
Conversation
Hmm - I don't think such a mechanism is needed when writing instrumentation, because semantic conventions don't exist (unlike something like span name) I can't think of any functionality or convenience benefit of implementing a listener vs just calling the code directly after creating the context. Users may want to do it though, even a propagator doesn't seem to work to populate something from the request body into baggage for example. Something like a context customizer would be a more targeted so somewhat easier to implement knob for this specific use case. There is something to say about our request listeners being the way libraries expose interception to the world, in which case we do need the kitchen sink API. But there seems to be little interest in the OTel community in this direction so if focusing on an API for instrumentation only I guess we don't need it (unless I missed something in my first paragraph of this comment). |
💯 |
Oh, there was one issue about adding exception to |
Thanks for opening the PR. The comment was mostly about exploring options and stylistic preferences, especially as in this case the instrumentation is split between two parts. I do have a local branch where I've refactored the |
closing this, discussed with @anuraaga and @mateuszrzeszutek, I will send a PR to implement "context customizer" knob that has single method |
@HaloFour in slack asked about passing the request to
RequestListener.start()
in order to amend the context with info from the request, which seems to be a common use case, e.g.HttpServerTracer.customizeContext(Context, REQUEST) -> Context
.And if we're going to pass request to
start()
, for consistency it seems to make sense to passrequest, response, error
toend()
.Though I'm not sure adding those to
end()
has a real use case.An alternative to this PR is a more targeted approach which adds a new interface that just supports the "customize context" use case, something like just a single method
Context start(Context, REQUEST)
.I'm kind of torn between the two options. I do prefer the more targeted solution, but the kitchen sink option (this PR) may be more future proof.
cc: @anuraaga @mateuszrzeszutek