Auto-navigate to Events tab when clicking error spans#20188
Auto-navigate to Events tab when clicking error spans#20188harupy merged 4 commits intomlflow:masterfrom
Conversation
Signed-off-by: Anshuman Sahu <anshumansahu18@gmail.com>
🛠 DevTools 🛠
Install mlflow from this PRFor Databricks, use the following command: |
There was a problem hiding this comment.
Pull request overview
This PR adds functionality to auto-navigate to the Events tab when users click on spans with errors in the Tracing UI. This improves user experience by automatically displaying error details when an error span is selected.
Changes:
- Modified
TimelineTree.tsxto detect error conditions on span click and navigate to Events tab - Updated
ModelTraceExplorerViewStateContext.tsxto automatically switch to Events tab when a node with errors is selected
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
mlflow/server/js/src/shared/web-shared/model-trace-explorer/timeline-tree/TimelineTree.tsx |
Adds error detection logic in onSpanClick callback to navigate to Events tab when error spans are clicked |
mlflow/server/js/src/shared/web-shared/model-trace-explorer/ModelTraceExplorerViewStateContext.tsx |
Adds useEffect hook to auto-navigate to Events tab when selectedNode has errors |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const hasError = | ||
| node.status?.code === 'STATUS_CODE_ERROR' || | ||
| node.status?.status_code === 'STATUS_CODE_ERROR' || | ||
| (node.events && node.events.length > 0 && | ||
| node.events.some(event => | ||
| event.name === 'exception' || | ||
| event.attributes?.['exception.type'] | ||
| )); |
There was a problem hiding this comment.
The error detection logic here is duplicated in ModelTraceExplorerViewStateContext.tsx (lines 142-150). Consider extracting this logic into a shared utility function to improve maintainability and ensure consistency. For example, create a function like hasSpanError(node: ModelTraceSpanNode): boolean in ModelTraceExplorer.utils.tsx.
.../server/js/src/shared/web-shared/model-trace-explorer/ModelTraceExplorerViewStateContext.tsx
Outdated
Show resolved
Hide resolved
| const defaultActiveTab = getDefaultActiveTab(selectedNode); | ||
| setActiveTab(defaultActiveTab); | ||
| } | ||
| }, [selectedNode]); |
There was a problem hiding this comment.
The useEffect hook is missing setActiveTab in its dependency array. According to React Hooks rules, all values from the component scope that are used inside the effect should be included in the dependency array. Add setActiveTab to the dependency array to fix this exhaustive-deps warning.
| }, [selectedNode]); | |
| }, [selectedNode, setActiveTab]); |
mlflow/server/js/src/shared/web-shared/model-trace-explorer/timeline-tree/TimelineTree.tsx
Outdated
Show resolved
Hide resolved
|
Documentation preview for 48a321d is available at: More info
|
.../server/js/src/shared/web-shared/model-trace-explorer/ModelTraceExplorerViewStateContext.tsx
Show resolved
Hide resolved
Use getSpanExceptionCount in getDefaultActiveTab instead of duplicating error detection logic in multiple places. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
| // Auto-navigate to events tab when span has errors | ||
| if (getSpanExceptionCount(selectedNode) > 0) { | ||
| return 'events'; | ||
| } |
joelrobin18
left a comment
There was a problem hiding this comment.
Can we add a test case as well?
Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
harupy
left a comment
There was a problem hiding this comment.
Added a test case for the error span auto-navigation in getDefaultActiveTab tests.
Signed-off-by: Anshuman Sahu <anshumansahu18@gmail.com> Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> Co-authored-by: harupy <17039389+harupy@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Anshuman Sahu <anshumansahu18@gmail.com> Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> Co-authored-by: harupy <17039389+harupy@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Anshuman Sahu <anshumansahu18@gmail.com> Signed-off-by: harupy <17039389+harupy@users.noreply.github.com> Co-authored-by: harupy <17039389+harupy@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
Related Issues/PRs
20187
Resolve #20187
What changes are proposed in this pull request?
This PR adds the functionality to auto-navigate to the Events tab when users click on spans with errors in the Tracing UI.
How is this PR tested?
Before:-
before.mp4
After:-
after.mp4
Does this PR require documentation update?
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.