Conversation
|
Exciting! Let us know when to review (should we wait for it for this week's release?). Otherwise we'll rely on you for testing that it works for real ;) |
There was a problem hiding this comment.
❌ Changes requested. Reviewed everything up to 580bb56 in 43 seconds
More details
- Looked at
338lines of code in2files - Skipped
0files when reviewing. - Skipped posting
1drafted comments based on config settings.
1. hamilton/plugins/h_ddog.py:391
- Draft comment:
The docstring forAsyncDDOGTraceris repeated fromDDOGTracer. Consider refactoring to avoid repetition and adhere to the DRY principle. - Reason this comment was not posted:
Marked as duplicate.
Workflow ID: wflow_3sEbPU4BnSyc1fM2
Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.
| ): | ||
| """Runs after graph execution. Garbage collects + finishes the root span. | ||
|
|
||
| :param error: Error the graph raised when running, if any |
There was a problem hiding this comment.
The run_after_task_execution method is not utilized in AsyncDDOGTracer. Consider implementing this method for async task execution as well.
There was a problem hiding this comment.
This is rightly pointed out, but not sure if I need it: is async mode & dynamic/task mode compatible? I assume "task" here refers to the parallelize/collect flow.
There was a problem hiding this comment.
Yes, this is specifically not supported (right now). I think this is good for now -- add a note about it.
Thanks @skrawcz, ready to review. Tested out both sync and async versions, and added some screenshots here in the description |
| :param future_kwargs: reserved for future keyword arguments/backwards compatibility. | ||
| """ | ||
| span = tracer.start_span(name=self.root_name, activate=True, service=self.service) | ||
| current_context = tracer.current_trace_context() |
There was a problem hiding this comment.
This returns None if there's no active trace, so will be a safe no-op if there isn't one. child_of in start_span is None by default, so we're just assigning the parent if it exists.
There was a problem hiding this comment.
Worth adding this as a comment
There was a problem hiding this comment.
Good idea — added!
elijahbenizzy
left a comment
There was a problem hiding this comment.
Looks really clean! Nice work. Only comments are about comments int he code -- a little bit of design choice can make it a bit easier to maintain.
Otherwise if you add some comments and push another one I'll merge + release shortly.
| To use this, you'll want to run `pip install sf-hamilton[ddog]` (or `pip install "sf-hamilton[ddog]"` if using zsh) | ||
| """ | ||
|
|
||
| class _DDOGTracerImpl: |
There was a problem hiding this comment.
Add a docstring for the reasoning of having a composition-based class (rather than inheritance) -- e.g. sync versus async. Good choice, IMO, but worth clarifying in the code.
| :param future_kwargs: reserved for future keyword arguments/backwards compatibility. | ||
| """ | ||
| span = tracer.start_span(name=self.root_name, activate=True, service=self.service) | ||
| current_context = tracer.current_trace_context() |
There was a problem hiding this comment.
Worth adding this as a comment
| ): | ||
| """Runs after graph execution. Garbage collects + finishes the root span. | ||
|
|
||
| :param error: Error the graph raised when running, if any |
There was a problem hiding this comment.
Yes, this is specifically not supported (right now). I think this is good for now -- add a note about it.
Adds
AsyncDDOGTracer, which has all the same functionality ofDDOGTracerbut inherits from the base async lifecycle classes to make it work with the AsyncDriver. Fixes #1236.Changes
AsyncDDOGTracerDDOGTracerfunctionality into private_DDOGTracerImpl, which allows sharing logic between the sync & async versionsAsyncDDOGTracerreferenceHow I tested this
Tested 1.83.3 to verify behavior of all nodes showing executed quickly at the beginning:

Tested new implementation of standard DDOGTracer to ensure it works as expected (notice Hamilton is now nested under the FastAPI parent span):

Tested new async implementation:

Notes
Checklist