You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
The current DDOGTracer with AsyncDriver creates a span for each Hamilton function/node when it creates a coroutine, but doesn't track when the function actually runs. It would be great to have it track timing of the actual function body execution for more accurate metrics.
Also when using Hamilton in a FastAPI app, the FastAPI middleware tracer is not correlating the Hamilton trace as a child, i.e. 2 separate traces appear in DataDog. Ideally the Hamilton trace uses the current FastAPI request trace as its parent.
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
Open to using the OTel adapter instead of DDog if it's any easier to implement these changes.
Change the superclasses -- see note below. We'd want to make them async.
Add the right (same) code (pretty sure the same thing is what you want)?
Ensure the state we keep is async-friendly (pretty sure it'll work)
Regarding (2) -- currently this subclasses three user-facing classes lifecycle.NodeExecutionHook, lifecycle.GraphExecutionHook, lifecycle.TaskExecutionHook. We don't have asynchronous version sof these, so we could either (1) subclass the right async hooks directly, or (2) create the user-facing versions of them (an equivalent class).
Note we could also do something clever by sharing code between the two, or at least having helper functions.
Otherwise, it's the same exact process as OTel (see this class), although I'd be curious if we'll run into async issues there (I assume it just works but we'd need to verify).
I got an async ddog version working in #1247. Tried the OTel adapter and didn't spend too much time debugging, but it seemed to add some overhead and/or block the event loop. Focused instead on getting ddog to work with async.
Is your feature request related to a problem? Please describe.
The current DDOGTracer with AsyncDriver creates a span for each Hamilton function/node when it creates a coroutine, but doesn't track when the function actually runs. It would be great to have it track timing of the actual function body execution for more accurate metrics.
Also when using Hamilton in a FastAPI app, the FastAPI middleware tracer is not correlating the Hamilton trace as a child, i.e. 2 separate traces appear in DataDog. Ideally the Hamilton trace uses the current FastAPI request trace as its parent.
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
Open to using the OTel adapter instead of DDog if it's any easier to implement these changes.
Additional context
Slack thread: https://hamilton-opensource.slack.com/archives/C03M33QB4M8/p1731597046007369
The text was updated successfully, but these errors were encountered: