-
Couldn't load subscription status.
- Fork 466
feat(aiobs): add tracing hook for ray ml framework #14038
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
Closed
Closed
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f9d8a43
Add tracing hook for Ray ML framework
imran-at-datadog dc22e14
Rename trace filter
imran-at-datadog ada9d5d
Merge branch 'main' into imran-hendley/add-ray-tracing-hook
imran-at-datadog 09cad8a
Make ml-observability owner of ddtrace/aiobs/
imran-at-datadog 9a5e5d5
ruff format tracer.py
imran-at-datadog eb56317
ruff check --fix tracer.py
imran-at-datadog 3db74a6
Merge branch 'main' into imran-hendley/add-ray-tracing-hook
imran-at-datadog 92e3aab
Merge branch 'main' into imran-hendley/add-ray-tracing-hook
imran-at-datadog ac4ce3f
aiobs -> _aiobs to mark as beta
imran-at-datadog abe623e
Merge branch 'main' into imran-hendley/add-ray-tracing-hook
imran-at-datadog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import os | ||
| os.environ["DD_TRACE_OTEL_ENABLED"] = "true" | ||
|
|
||
| from opentelemetry.trace import set_tracer_provider | ||
| from ddtrace.opentelemetry import TracerProvider | ||
| from ddtrace.trace import tracer | ||
| from ddtrace.trace import TraceFilter | ||
|
|
||
|
|
||
| class RayTraceFilter(TraceFilter): | ||
| def process_trace(self, trace): | ||
| for span in trace: | ||
| span.span_type = "ray." + span.name | ||
| span.name = "ray.job" | ||
| span.service = os.environ.get("DD_SERVICE", "unspecified-ray-job") | ||
| span.set_metric("_dd.djm.enabled", 1) | ||
| span.set_metric("_dd.filter.kept", 1) | ||
| span.set_metric("_dd.measured", 1) | ||
| span.set_metric("_sampling_priority_v1", 2) | ||
| return trace | ||
|
|
||
|
|
||
| def setup_tracing() -> None: | ||
brettlangdon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| tracer.configure(trace_processors=[RayTraceFilter()]) | ||
| set_tracer_provider(TracerProvider()) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.