-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add tracing to Ray #14872
Add tracing to Ray #14872
Conversation
can you move all functions in the core files, and the dict_propogator, to a new file called tracing.py? |
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.
let's add docs. and figure out consistent naming scheme:
- make_/inject_
- tracing_* task/actors.
python/ray/dict_propagator.py
Outdated
@@ -0,0 +1,15 @@ | |||
from typing import Any, cast, Dict | |||
|
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.
inline this to tracing
python/ray/remote_function.py
Outdated
self._function_name = ( | ||
self._function.__module__ + "." + self._function.__name__) | ||
function.__module__ + "." + function.__name__) | ||
print(f"function name is {self._function_name}") |
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.
pop this line
python/ray/remote_function.py
Outdated
@@ -105,6 +110,33 @@ def _remote_proxy(*args, **kwargs): | |||
|
|||
self.remote = _remote_proxy | |||
|
|||
@staticmethod | |||
def _tracing_wrap_function(function): |
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.
move this to a pure function in tracing.py
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.
naming: inject_tracing_into_function(function)
python/ray/util/tracing.py
Outdated
|
||
|
||
@contextmanager | ||
def use_context(parent_context: Context, ) -> Generator[None, None, None]: |
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.
def use_context(parent_context: Context, ) -> Generator[None, None, None]: | |
def use_context(parent_context: Context) -> Generator[None, None, None]: |
python/ray/actor.py
Outdated
@@ -131,6 +131,7 @@ def remote(self, *args, **kwargs): | |||
|
|||
return FuncWrapper() | |||
|
|||
@actor_method_tracing_local |
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.
naming: tracing_actor_invocation
python/ray/remote_function.py
Outdated
@@ -169,6 +201,7 @@ def remote(self, *args, **kwargs): | |||
|
|||
return FuncWrapper() | |||
|
|||
@_propagate_trace |
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.
tracing_task_invocation
python/ray/util/tracing.py
Outdated
from contextlib import contextmanager | ||
import inspect | ||
import os | ||
import wrapt |
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.
let's try to remove wrapt as a dependency
# Skip tracing for staticmethod or classmethod, because these method | ||
# might not be called directly by remote calls. Additionally, they are | ||
# tricky to get wrapped and unwrapped. | ||
if is_static_method(_cls, name) or is_class_method(method): |
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.
if is_static_method(_cls, name) or is_class_method(method): | |
if is_static_method(_cls, name) or is_class_method(method) or not is_tracing_enabled(): |
and remove it from span_wrapper
and async_span_wrapper
Why are these changes needed?
This PR adds a prototype for OpenTelemetry tracing in Python level for Ray tasks and actors.
Related issue number
Checks
scripts/format.sh
to lint the changes in this PR.