Skip to content

Write RFC to add Span Links to MLFlow#6

Merged
B-Step62 merged 3 commits intomlflow:mainfrom
khaledsulayman:add-otel-spanlink
Apr 9, 2026
Merged

Write RFC to add Span Links to MLFlow#6
B-Step62 merged 3 commits intomlflow:mainfrom
khaledsulayman:add-otel-spanlink

Conversation

@khaledsulayman
Copy link
Copy Markdown
Contributor

@khaledsulayman khaledsulayman commented Mar 31, 2026

Proposal for adding support for Span Links, an OTel primitive. This was requested in mlflow/mlflow#21025

@khaledsulayman
Copy link
Copy Markdown
Contributor Author

@B-Step62


```python
for link in span_a_links:
span_b.add_link(link)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This API should be sufficent to cover @mlflow.trace. Users can call mlflow.get_current_active_span() to fetch the span object inside the function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true. However, OTel prefers linking at span start-time vs. after. The main reason for this is head sampling, i.e. links are needed at span start time so _MlflowSampler can catch them.

It's debatable whether or not this is worth the extra complexity.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://opentelemetry.io/docs/languages/dotnet/traces/links-based-sampler/ worth considering if we want to enable links-based sampling in the future.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see, thanks for the clarification! I'm fine with starting with limited set of apis to keep sampling logic simple.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! I'll keep it in the "maybe" list of entry points and during development we can see in practice if it's worth the extra complexity.

@B-Step62
Copy link
Copy Markdown
Contributor

B-Step62 commented Apr 3, 2026

@khaledsulayman Thanks for the proposal! Left a few comments

Signed-off-by: Khaled Sulayman <ksulayma@redhat.com>

Co-Authored-By: Claude <noreply@anthropic.com>
@khaledsulayman
Copy link
Copy Markdown
Contributor Author

@B-Step62 Scoped the api.ts changes and left some follow-ups! Let me know what you think

Copy link
Copy Markdown
Contributor

@B-Step62 B-Step62 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great once #6 (comment) is addressed!

Signed-off-by: Khaled Sulayman <ksulayma@redhat.com>
Signed-off-by: Khaled Sulayman <ksulayma@redhat.com>
@khaledsulayman
Copy link
Copy Markdown
Contributor Author

Addressed! Also updated the name because an RFC 0002 has already merged.

@khaledsulayman
Copy link
Copy Markdown
Contributor Author

khaledsulayman commented Apr 9, 2026

@B-Step62 are we good to merge? Or do we need another review?

@B-Step62 B-Step62 merged commit 3cbb480 into mlflow:main Apr 9, 2026
@B-Step62
Copy link
Copy Markdown
Contributor

B-Step62 commented Apr 9, 2026

@khaledsulayman Yes, please feel free to go ahead to the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants