-
Notifications
You must be signed in to change notification settings - Fork 95
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
DDOG Integration #644
DDOG Integration #644
Conversation
0b8dc90
to
baeb0d8
Compare
We were missing this -- this adds it in.
This is a bit of a joke -- it just injects latency into the DAG. Purely for testing, but perhaps someone can do something fun with it.
This is functionally the same as before, it just hits a weird edge case in which a failure to deliver the hook would be called twice, as it would fail when running it and fail when reacting to the failure (in the catch). We need to do this for graph/node.
baeb0d8
to
c09bdbf
Compare
2de00ca
to
eef0e60
Compare
for adapter in self.adapters: | ||
for cls in inspect.getmro(adapter.__class__): | ||
sync_hook = getattr(cls, SYNC_HOOK, None) | ||
if sync_hook is not None: | ||
sync_hooks[sync_hook].add(adapter) | ||
if adapter not in sync_hooks[sync_hook]: | ||
sync_hooks[sync_hook].append(adapter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, this is not ironed into the contract, and we'll likely want to switch around order, but I think for the future we need to think about this a bit -- my instinct says to do pre_
in order and post_
in reverse order, but that's complicated and ambiguous to implement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes we should do it that way ideally
from hamilton import lifecycle | ||
|
||
|
||
class DDOGTracer( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could add testing but I don't think its worth it, I'll just fix forward and if its a pain add testing
time.sleep(sleep_time) | ||
|
||
|
||
class SlowDownYouMoveTooFast(NodeExecutionHook): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Easter egg
eef0e60
to
13366f8
Compare
hamilton/plugins/h_ddog.py
Outdated
) -> Tuple[Optional[str], ...]: | ||
return run_id, task_id, node_id | ||
def _serialize_span_dict(span_dict: Dict[str, Span]): | ||
"""Serializes to a readable format. We're not propogating links, but that's fine (for now). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean link?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Span links -- see notes elsewhere
68343d0
to
319234f
Compare
This adds basic tracing support for the datadog plugin. We elect to manage the state of spans/traces ourselves, and there is a decent amount of complexity around serialization. It works on Ray, Dask, Multithreading, and Synchronous mode, as well as vanilla Hamilton (non-task-based). It can optionally store links, although datadogs functionality is pretty suboptimal and has large UI query times, so that is turned off by default.
This ensures that it is only run once, and cleans up the code.
This ensures we don't accidentally run it twice if it fails, and cleans up the code.
This makes it slightly easier to filter by node name, across, say, different tasks. We namespace it under hamilton to ensure it doesn't clash.
We were doing the wrong ones for required_dependencies. This fixes that, and also uses input_types (rather than dependencies) for the required/optional dependencies, which is guarenteed to exist when the node is created (as opposed to dependencies which is set when we create the DAG.
319234f
to
4120268
Compare
Iterating -- plan of attack/thoughts:
What this looks like:
Changes
How I tested this
Notes
Checklist