Display notebook trace viewer when workspace is on#20947
Display notebook trace viewer when workspace is on#20947TomeHirata merged 2 commits intomlflow:masterfrom
Conversation
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
🛠 DevTools 🛠
Install mlflow from this PRFor Databricks, use the following command: |
|
Documentation preview for 1fa7a95 is available at: More info
|
…rOSSNotebookRenderer Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
| const getMlflowUILinkForTrace = (traceId: string, experimentId: string) => { | ||
| const queryParams = new URLSearchParams(); | ||
| queryParams.append('selectedTraceId', traceId); | ||
| queryParams.append('selectedEvaluationId', traceId); |
There was a problem hiding this comment.
It seems this has been broken regardless of workspace change. I wonder why we're using "selectedEvaluationId" for trace id.
There was a problem hiding this comment.
hmm weird, i wonder when this changed ah i think this was in the trace v2 -> v3 page migration. regardless thank you for fixing!
There was a problem hiding this comment.
Pull request overview
This pull request fixes an issue where the trace viewer in Jupyter notebooks was not displaying correctly when workspace functionality is enabled on the MLflow tracking server. The fix ensures that workspace context is properly propagated through both the Python backend (when generating iframe URLs) and the JavaScript frontend (when initializing the trace viewer).
Changes:
- Added workspace query parameter to notebook iframe URLs when workspace is set
- Set workspace context in the notebook renderer bootstrap before rendering
- Corrected the trace link URL to use the proper
/tracesroute andselectedEvaluationIdquery parameter
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| mlflow/tracing/display/display_handler.py | Added workspace query parameter to iframe URL when workspace context is available |
| tests/tracing/display/test_ipython.py | Added test to verify workspace parameter is included in iframe HTML |
| mlflow/server/js/src/shared/web-shared/model-trace-explorer/oss-notebook-renderer/bootstrap.tsx | Extract workspace from URL and set it before rendering to ensure API calls include workspace header |
| mlflow/server/js/src/shared/web-shared/model-trace-explorer/oss-notebook-renderer/ModelTraceExplorerOSSNotebookRenderer.tsx | Fixed trace link URL to use correct route path and query parameter, added workspace to query params |
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
Related Issues/PRs
n/a
What changes are proposed in this pull request?
Fix the issue that trace viewer on notebooks is not displayed due to the lack of workspace header when workspace is enabled on the tracking server.
How is this PR tested?
Does this PR require documentation update?
Does this PR require updating the MLflow Skills repository?
Release Notes
Is this a user-facing change?
What component(s), interfaces, languages, and integrations does this PR affect?
Components
area/tracking: Tracking Service, tracking client APIs, autologgingarea/models: MLmodel format, model serialization/deserialization, flavorsarea/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registryarea/scoring: MLflow Model server, model deployment tools, Spark UDFsarea/evaluation: MLflow model evaluation features, evaluation metrics, and evaluation workflowsarea/gateway: MLflow AI Gateway client APIs, server, and third-party integrationsarea/prompts: MLflow prompt engineering features, prompt templates, and prompt managementarea/tracing: MLflow Tracing features, tracing APIs, and LLM tracing functionalityarea/projects: MLproject format, project running backendsarea/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev serverarea/build: Build and test infrastructure for MLflowarea/docs: MLflow documentation pagesHow should the PR be classified in the release notes? Choose one:
rn/none- No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" sectionrn/breaking-change- The PR will be mentioned in the "Breaking Changes" sectionrn/feature- A new user-facing feature worth mentioning in the release notesrn/bug-fix- A user-facing bug fix worth mentioning in the release notesrn/documentation- A user-facing documentation change worth mentioning in the release notesShould this PR be included in the next patch release?
Yesshould be selected for bug fixes, documentation updates, and other small changes.Noshould be selected for new features and larger changes. If you're unsure about the release classification of this PR, leave this unchecked to let the maintainers decide.What is a minor/patch release?
Bug fixes, doc updates and new features usually go into minor releases.
Bug fixes and doc updates usually go into patch releases.