Skip to content

Auto-navigate to Events tab when clicking error spans#20188

Merged
harupy merged 4 commits intomlflow:masterfrom
anshuman-sahu:error-span-navigate
Jan 23, 2026
Merged

Auto-navigate to Events tab when clicking error spans#20188
harupy merged 4 commits intomlflow:masterfrom
anshuman-sahu:error-span-navigate

Conversation

@anshuman-sahu
Copy link
Contributor

@anshuman-sahu anshuman-sahu commented Jan 21, 2026

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?

  • Existing unit/integration tests
  • New unit/integration tests
  • Manual tests

Before:-

before.mp4

After:-

after.mp4

Does this PR require documentation update?

  • No. You can skip the rest of this section.
  • Yes. I've updated:
    • Examples
    • API references
    • Instructions

Release Notes

Is this a user-facing change?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release notes for MLflow users.

What component(s), interfaces, languages, and integrations does this PR affect?

Components

  • area/tracking: Tracking Service, tracking client APIs, autologging
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/scoring: MLflow Model server, model deployment tools, Spark UDFs
  • area/evaluation: MLflow model evaluation features, evaluation metrics, and evaluation workflows
  • area/gateway: MLflow AI Gateway client APIs, server, and third-party integrations
  • area/prompts: MLflow prompt engineering features, prompt templates, and prompt management
  • area/tracing: MLflow Tracing features, tracing APIs, and LLM tracing functionality
  • area/projects: MLproject format, project running backends
  • area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev server
  • area/build: Build and test infrastructure for MLflow
  • area/docs: MLflow documentation pages

How 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" section
  • rn/breaking-change - The PR will be mentioned in the "Breaking Changes" section
  • rn/feature - A new user-facing feature worth mentioning in the release notes
  • rn/bug-fix - A user-facing bug fix worth mentioning in the release notes
  • rn/documentation - A user-facing documentation change worth mentioning in the release notes

Should this PR be included in the next patch release?

Yes should be selected for bug fixes, documentation updates, and other small changes. No should 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?
  • Minor release: a release that increments the second part of the version number (e.g., 1.2.0 -> 1.3.0).
    Bug fixes, doc updates and new features usually go into minor releases.
  • Patch release: a release that increments the third part of the version number (e.g., 1.2.0 -> 1.2.1).
    Bug fixes and doc updates usually go into patch releases.
  • Yes (this PR will be cherry-picked and included in the next patch release)
  • No (this PR will be included in the next minor release)

Signed-off-by: Anshuman Sahu <anshumansahu18@gmail.com>
@github-actions github-actions bot added area/tracing MLflow Tracing and its integrations rn/feature Mention under Features in Changelogs. labels Jan 21, 2026
@github-actions
Copy link
Contributor

🛠 DevTools 🛠

Install mlflow from this PR

# mlflow
pip install git+https://github.com/mlflow/mlflow.git@refs/pull/20188/merge
# mlflow-skinny
pip install git+https://github.com/mlflow/mlflow.git@refs/pull/20188/merge#subdirectory=libs/skinny

For Databricks, use the following command:

%sh curl -LsSf https://raw.githubusercontent.com/mlflow/mlflow/HEAD/dev/install-skinny.sh | sh -s pull/20188/merge

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.tsx to detect error conditions on span click and navigate to Events tab
  • Updated ModelTraceExplorerViewStateContext.tsx to 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.

Comment on lines +44 to +51
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']
));
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
const defaultActiveTab = getDefaultActiveTab(selectedNode);
setActiveTab(defaultActiveTab);
}
}, [selectedNode]);
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
}, [selectedNode]);
}, [selectedNode, setActiveTab]);

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

github-actions bot commented Jan 21, 2026

Documentation preview for 48a321d is available at:

More info
  • Ignore this comment if this PR does not change the documentation.
  • The preview is updated when a new commit is pushed to this PR.
  • This comment was created by this workflow run.
  • The documentation was built by this workflow run.

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>
@harupy harupy requested a review from joelrobin18 January 23, 2026 00:22
Comment on lines +1172 to +1175
// Auto-navigate to events tab when span has errors
if (getSpanExceptionCount(selectedNode) > 0) {
return 'events';
}
Copy link
Member

Choose a reason for hiding this comment

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

@daniellok-db applied your suggestion. It works!

Copy link
Collaborator

@joelrobin18 joelrobin18 left a comment

Choose a reason for hiding this comment

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

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>
Copy link
Member

@harupy harupy left a comment

Choose a reason for hiding this comment

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

Added a test case for the error span auto-navigation in getDefaultActiveTab tests.

@harupy harupy requested a review from joelrobin18 January 23, 2026 00:32
Copy link
Collaborator

@joelrobin18 joelrobin18 left a comment

Choose a reason for hiding this comment

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

LGTM

@harupy harupy added the v3.9.0 label Jan 23, 2026
@harupy harupy added this pull request to the merge queue Jan 23, 2026
Merged via the queue into mlflow:master with commit 95cad56 Jan 23, 2026
60 of 63 checks passed
harupy added a commit to harupy/mlflow that referenced this pull request Jan 28, 2026
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>
harupy added a commit to harupy/mlflow that referenced this pull request Jan 28, 2026
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>
harupy added a commit that referenced this pull request Jan 28, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tracing MLflow Tracing and its integrations rn/feature Mention under Features in Changelogs. v3.9.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FR]Auto-navigate to Events tab when clicking error spans

5 participants