-
Notifications
You must be signed in to change notification settings - Fork 49
Add hooks for distributed tracing #201
Comments
I’m a fan of having hooks for these kinds of things … is there any chance you could put together a proposal for how an API for this should look like? |
I'm also happy to have these built in. A couple comments tho...
// headers is the actual block of headers, type is an indication of
// whether they are informational, initial, or trailing headers
stream.on('outgoingHeaders', (headers, type) => {
headers['NEW_HEADER_TO_ADD'] = 'trackingID'
}); Keep in mind, however, that with QUIC, header support is only enabled per Application protocol. Not all QUIC protocols will support headers so this will be best effort at best. It would always work when using HTTP/3, however. This approach is something we can easily backport to the http/2 and http/1 implementations as well, although with http/1 it would be a bit more difficult to support consistently due to how headers are handled there. I'm not sure about the need for an inbound header hook in the low level API, but if it is needed, it can be handled as
|
Thanks for your answers. Sure, I can draft a more concrete API (but will take a while...) Regarding static hook and use of transform in stream. I agree that these are not needed if monitoring would be implemented as part of the application. But the typical use case is that you have an existing application and an additional, independent module from some other vendor is preloaded to add monitoring (e.g. via -r command line argument). This monitoring module needs to get the information about new sockets to install the followup listeners it uses to record transactions and to transform the data. And sure, monitoring like this has an overhead. The overhead should be mostly the same if hooks are used compared to monkey patching. |
The QUIC API looks quite similar as the HTTP/2 API but has still some ToDos inside therefore I think it's a good starting point to describe how we capture data from HTTP/2. Server:
Captured data:
Advance features (not yet in use for HTTP/2 but in HTTP):
I think we could get the same functionality with following hooks:
Client:
Captured data:
I think we could get the same functionality with following hooks:
Context propagation
I think this can work with above hooks if following conditions are met:
|
Not sure if it is the correct time to start this topic as there seem to be quite a lot other todos open which are more important. But I think it can't hurt to start a discussion early regarding this but feel free to defer this or move it to a better place.
Is your feature request related to a problem? Please describe.
Support for distributed tracing (e.g. OpenTelemetry, APMs) requires monkey patching at this time. I as thinking about adding hooks in core intended for tools like OpenTelemetry and APMs to get data they need and to inject required data.
Describe the solution you'd like
Monitoring tools like OpenTelemetry, APMs,... use monkey patching since a long time to hook into various libraries to gather the data they need and to inject their tags to link transactions of distributed applications.
I think core could include hooks to provide the data needed by such tools to avoid (or at least reduce) the need of monkey patching.
I think having hooks on HTTP/3 is most likely more important as hooks on Quic.
A fast guess of which hooks would be helpful:
It's also important to allow these tools to associate their context to the async transactions involved (from high level HTTP/3 protocol point of view). As a http request is mapped to a stream this will most likely work out of the box by using async hooks.
Describe alternatives you've considered
Keep using monkey patching. Ensure that exposed public API allows to capture the needed information if monkey patched.
The text was updated successfully, but these errors were encountered: