Skip to content

[UI Telemetry] Add rudimentary logging for navbar clicks#19480

Merged
daniellok-db merged 11 commits intomlflow:masterfrom
daniellok-db:stack/logging-for-tabs
Dec 18, 2025
Merged

[UI Telemetry] Add rudimentary logging for navbar clicks#19480
daniellok-db merged 11 commits intomlflow:masterfrom
daniellok-db:stack/logging-for-tabs

Conversation

@daniellok-db
Copy link
Collaborator

@daniellok-db daniellok-db commented Dec 18, 2025

🥞 Stacked PR

Use this link to review incremental changes.


Related Issues/PRs

#xxx

What changes are proposed in this pull request?

Quick PR to add some rudimentary logging for tab clicks. Currently it is not logged due to the <Link> component not being a design system component (it's from react-router-dom).

Eventually it would be nice to have some context provider that automatically injects the current tab into the observability logs, but that will be a larger more complex change.

How is this PR tested?

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

Checked that logs are indeed logged:

Screen.Recording.2025-12-18.at.1.12.50.PM.mov

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)

import { DesignSystemObservabilityEvent } from '../types';
import { telemetryClient } from '../TelemetryClient';

export const useLogTelemetryEvent = () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this will be edge blocked upstream and replaced with something that works in non-OSS

const { experimentId } = useParams();
const { search } = useLocation();
const logTelemetryEvent = useLogTelemetryEvent();
const viewId = crypto.randomUUID();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is not strictly accurate because viewId should be tied to the component itself, while this is generated in the parent component. however practically it's not a critical field and linking to parent is still better than nothing

const { theme } = useDesignSystemTheme();
const invalidateExperimentList = useInvalidateExperimentList();
const navigate = useNavigate();
const viewId = crypto.randomUUID();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@daniellok-db daniellok-db changed the title rudimentary logging [UI Telemetry] Add rudimentary logging for navbar clicks Dec 18, 2025
@daniellok-db daniellok-db marked this pull request as ready for review December 18, 2025 04:30
Copilot AI review requested due to automatic review settings December 18, 2025 04:30
@github-actions
Copy link
Contributor

@daniellok-db Thank you for the contribution! Could you fix the following issue(s)?

⚠ DCO check

The DCO check failed. Please sign off your commit(s) by following the instructions here. See https://github.com/mlflow/mlflow/blob/master/CONTRIBUTING.md#sign-your-work for more details.

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 rudimentary telemetry logging for navigation clicks in the MLflow UI. As part of a broader UI telemetry effort, it implements click tracking for sidebar navigation links and experiment page side navigation tabs.

Key Changes

  • Adds telemetry event logging hook (useLogTelemetryEvent) for tracking UI interactions
  • Implements click tracking for main sidebar navigation items and experiment page side navigation tabs
  • Introduces a new Settings page with telemetry preferences toggle
  • Adds informational alert about UI telemetry on the home page
  • Updates documentation with details about UI interaction metadata collection

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
mlflow/server/js/src/telemetry/utils.ts Adds version constant for telemetry alert dismissal tracking
mlflow/server/js/src/telemetry/types.ts Adds proper TypeScript types from design system for event types
mlflow/server/js/src/telemetry/hooks/useLogTelemetryEvent.tsx New hook for logging telemetry events with callback wrapper
mlflow/server/js/src/telemetry/TelemetryInfoAlert.tsx New component displaying informational alert about telemetry collection
mlflow/server/js/src/settings/SettingsPage.tsx New settings page allowing users to toggle telemetry preferences
mlflow/server/js/src/lang/default/en.json Adds localization strings for telemetry UI elements
mlflow/server/js/src/home/HomePage.tsx Integrates telemetry info alert on home page
mlflow/server/js/src/experiment-tracking/routes.ts Adds routing configuration for new settings page
mlflow/server/js/src/experiment-tracking/route-defs.ts Registers settings page route definition
mlflow/server/js/src/experiment-tracking/pages/experiment-page-tabs/side-nav/constants.tsx Adds componentId fields to side navigation items for telemetry tracking
mlflow/server/js/src/experiment-tracking/pages/experiment-page-tabs/side-nav/ExperimentPageSideNavSection.tsx Implements click event logging for experiment page side navigation tabs
mlflow/server/js/src/experiment-tracking/pages/experiment-page-tabs/side-nav/ExperimentPageSideNav.tsx Imports telemetry hook (unused)
mlflow/server/js/src/common/components/MlflowSidebar.tsx Adds click event logging for main sidebar navigation, adds Settings link
docs/docs/community/usage-tracking.mdx Documents UI interaction metadata and telemetry opt-out options

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +219 to +243
<Link
to={ExperimentTrackingRoutes.settingsPageRoute}
aria-current={isSettingsActive(location) ? 'page' : undefined}
css={{
display: 'flex',
alignItems: 'center',
gap: theme.spacing.sm,
color: theme.colors.textPrimary,
paddingInline: theme.spacing.md,
paddingBlock: theme.spacing.sm,
borderRadius: theme.borders.borderRadiusSm,
'&:hover': {
color: theme.colors.actionLinkHover,
backgroundColor: theme.colors.actionDefaultBackgroundHover,
},
'&[aria-current="page"]': {
backgroundColor: theme.colors.actionDefaultBackgroundPress,
color: theme.isDarkMode ? theme.colors.blue300 : theme.colors.blue700,
fontWeight: theme.typography.typographyBoldFontWeight,
},
}}
>
<GearIcon />
<FormattedMessage defaultMessage="Settings" description="Sidebar link for settings page" />
</Link>
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The Settings link is missing telemetry event logging. All other sidebar links have onClick handlers that log telemetry events, but the Settings link (lines 219-243) does not. This creates an inconsistency in telemetry data collection.

Add an onClick handler similar to the other links to ensure consistent telemetry tracking across all navigation elements.

Copilot uses AI. Check for mistakes.
const { theme } = useDesignSystemTheme();
const invalidateExperimentList = useInvalidateExperimentList();
const navigate = useNavigate();
const viewId = crypto.randomUUID();
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The viewId is generated once when the component renders and reuses the same UUID for all click events. According to the documentation (line 315 in usage-tracking.mdx), the componentViewId should be "regenerated whenever the UI element rerenders."

Currently, crypto.randomUUID() is called directly in the component body (line 45), which means it only generates once when the component mounts. This should be wrapped in a useMemo with an empty dependency array, or better yet, generate a new UUID for each interaction if that's the intended behavior based on the documentation.

Copilot uses AI. Check for mistakes.
const { experimentId } = useParams();
const { search } = useLocation();
const logTelemetryEvent = useLogTelemetryEvent();
const viewId = crypto.randomUUID();
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The viewId is generated once when the component renders and reuses the same UUID for all click events. According to the documentation (line 315 in usage-tracking.mdx), the componentViewId should be "regenerated whenever the UI element rerenders."

Currently, crypto.randomUUID() is called directly in the component body (line 35), which means it only generates once when the component mounts. This should be wrapped in a useMemo with an empty dependency array, or better yet, generate a new UUID for each interaction if that's the intended behavior based on the documentation.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is relevant too actually

@@ -1,5 +1,5 @@
import { useState } from 'react';
import { Header, useDesignSystemTheme } from '@databricks/design-system';
import { Alert, Button, Header, useDesignSystemTheme } from '@databricks/design-system';
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The imports Alert and Button from @databricks/design-system are not used anywhere in this file. These should be removed to keep the code clean.

Suggested change
import { Alert, Button, Header, useDesignSystemTheme } from '@databricks/design-system';
import { Header, useDesignSystemTheme } from '@databricks/design-system';

Copilot uses AI. Check for mistakes.
Comment on lines 9 to 10
import { useLogTelemetryEvent } from '@mlflow/mlflow/src/telemetry/hooks/useLogTelemetryEvent';

Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The import useLogTelemetryEvent is not used anywhere in this file. It should be removed to keep the code clean.

Suggested change
import { useLogTelemetryEvent } from '@mlflow/mlflow/src/telemetry/hooks/useLogTelemetryEvent';

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

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

@daniellok-db This comment seems to be relevant

@github-actions github-actions bot added v3.8.0 area/uiux Front-end, user experience, plotting, JavaScript, JavaScript dev server rn/none List under Small Changes in Changelogs. labels Dec 18, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 18, 2025

Documentation preview for e4e6f4c is available at:

Changed Pages (1)

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.

@daniellok-db daniellok-db force-pushed the stack/logging-for-tabs branch 2 times, most recently from 5c3387c to 85186cb Compare December 18, 2025 04:52
Copy link
Collaborator

@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.

LGTM

Comment on lines 9 to 10
import { useLogTelemetryEvent } from '@mlflow/mlflow/src/telemetry/hooks/useLogTelemetryEvent';

Copy link
Collaborator

Choose a reason for hiding this comment

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

@daniellok-db This comment seems to be relevant

Copy link
Collaborator

@serena-ruan serena-ruan left a comment

Choose a reason for hiding this comment

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

LGTM!

@daniellok-db daniellok-db force-pushed the stack/logging-for-tabs branch from 5021f8b to af235d3 Compare December 18, 2025 06:42
@daniellok-db daniellok-db force-pushed the stack/logging-for-tabs branch from af235d3 to e4e6f4c Compare December 18, 2025 07:25
@daniellok-db daniellok-db added this pull request to the merge queue Dec 18, 2025
Copy link
Collaborator

@hubertzub-db hubertzub-db left a comment

Choose a reason for hiding this comment

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

lg with a suggestion

const { experimentId } = useParams();
const { search } = useLocation();
const logTelemetryEvent = useLogTelemetryEvent();
const viewId = useMemo(() => crypto.randomUUID(), []);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if we could shove this inside useLogTelemetryEvent (which will be used as default componentViewId if not provided externally). This way, it's easier to reverse-EDGE-block in the future so it won't be executed in DB

Merged via the queue into mlflow:master with commit fbe920a Dec 18, 2025
54 of 55 checks passed
@daniellok-db daniellok-db deleted the stack/logging-for-tabs branch December 18, 2025 08:43
WeichenXu123 pushed a commit to WeichenXu123/mlflow that referenced this pull request Dec 19, 2025
@tobyxdd
Copy link

tobyxdd commented Dec 22, 2025

This change breaks HTTP deployments. On the front end users will see a blank screen with the this error message in the console "TypeError: crypto.randomUUID is not a function".

crypto.randomUUID() is only available when the connection is over HTTPS

@hubertzub-db
Copy link
Collaborator

@tobyxdd it should be fixed by #19644

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

Labels

area/uiux Front-end, user experience, plotting, JavaScript, JavaScript dev server rn/none List under Small Changes in Changelogs. v3.8.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants