-
Notifications
You must be signed in to change notification settings - Fork 191
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
Discussion: Instrumentation hooks allowing timing entire requests #494
Comments
I'd be open to adding such hooks to make instrumentation possible, with the caveat that we need to avoid any backwards incompatible changes. Also be aware that the current "hooks" system (if you can even call it that) is a bit of a mess, but hopefully that mess wouldn't impede this kind of change. |
Some food for thought: a minimally-invasive way to understand timing might be to update withResponse req man f = bracket (responseOpen req man) responseClose f could become withResponse req man f =
mWrapException man req $ bracket (responseOpen req man) responseClose f That would allow for instrumentation to understand timing of the entire time the response is open, assuming the user/library is using With |
I'd rather avoid (ab)using |
Hi! I'm posting this as part of investigating improving @iand675's hs-opentelemetry library's support for http-client.
If you're not familiar, OpenTelemetry lets people trace requests through distributed systems, with any number of services in them. It allows making spans for things that are happening at some point in time, as well as attaching metadata to them. I've used this technology at work to figure out why things are slow, for extracting database statements, and more.
Currently, the http-client instrumentation for hs-opentelemetry cannot instrument requests without requiring every library using it to import the instrumentation in place of http-client. This effectively means that libraries can't be instrumented, since they would gain a dependency on hs-opentelemetry-instrumentation-http-client.
There are two conceptual things that need to be done to HTTP requests to instrument them:
As far as I can tell, the current hooks in Manager aren't sufficient to fully instrument requests by merely changing the Manager. For instance, I could creatively use
managerWrapException
to time starting a request and receiving headers, but it's unclear how I could time the entirehttpLbs
since in large part, the hooks are about connection management, and there's not an obvious spot to hook "request done".Tracking issue: iand675/hs-opentelemetry#8
The text was updated successfully, but these errors were encountered: