Skip to content

Conversation

@JetoPistola
Copy link
Contributor

@JetoPistola JetoPistola commented Nov 7, 2025

Details

This PR implements the App Debugger Mode feature for Opik, providing app version information and network connectivity status to help with debugging and support. The feature is available for all Opik versions (not just Comet Cloud) and is accessible via a keyboard shortcut.

Feature Implementation

Frontend Changes:

  • Created AppDebugInfo component (in components/layout/) that displays:
    • App version (copyable) with Opik logo
    • Network connectivity status with RTT (Round Trip Time)
    • Keyboard shortcut handler: Meta/Ctrl + Shift + . to toggle debug overlay
    • State managed with useState and localStorage
  • Created AppNetworkStatus component (in components/layout/) with styled RTT display and tooltips
  • Uses react-hotkeys-hook for robust keyboard shortcut handling
  • Added shared platform detection utilities (isMac, modifierKey) in lib/utils.ts
  • Added useIsAlive API hook for backend health checks
  • Added useIsNetworkOnline hook for network status monitoring
  • Added Opik icon

Architecture:

  • Both AppDebugInfo and AppNetworkStatus components located in components/layout/ as they are layout-specific and not reusable
  • Available for all Opik installations (standalone and Comet Cloud)
  • Integrated in TopBar and PartialPageLayout components

UI/UX Improvements:

  • Keyboard shortcut provides seamless toggle without cluttering menu UI
  • Changed from Meta/Ctrl+c+. to Meta/Ctrl+Shift+. to avoid conflict with system copy command
  • Clean, minimal design that only appears when toggled on
  • Uses generic "backend server" terminology instead of "Comet server"

Design Decisions

  • Keyboard-only activation: Debugger mode toggles via Meta/Ctrl + Shift + . to keep UI clean
  • No feature toggle: Always available via keyboard shortcut, simplifying configuration
  • Simple state management: Uses useState with localStorage (key: comet-debugger-mode) for persistence
  • EM compatibility: Same localStorage key format as Extension Manager for consistency
  • Shared utilities: Platform detection logic centralized in lib/utils.ts to avoid duplication
  • Available for all versions: Not restricted to Comet Cloud, works in standalone Opik installations
  • Component organization: Both debugger components in layout folder since they are layout-specific and not reusable across the app

Technical Improvements

  • Replaced manual addEventListener with react-hotkeys-hook for better React integration
  • Extracted platform detection (isMac, modifierKey) to shared utilities
  • Moved components from plugins/comet/ to components/layout/ for proper architecture
  • Updated terminology to be version-agnostic ("backend server" vs "Comet server")

Change checklist

  • User facing
  • Documentation update

Issues

  • OPIK-2848
  • Relates to CM-13398

Testing

Manual Testing

  1. Press Meta/Ctrl + Shift + . to toggle debug overlay
  2. Verify overlay displays:
    • Opik version (copyable)
    • Network status with RTT
    • Backend server connection status
  3. Hover over icons to verify tooltips appear:
    • RTT value tooltip
    • Backend server connection status
    • Network connection status
  4. Verify localStorage persistence of debug mode state across page refreshes
  5. Test in both light and dark themes
  6. Test keyboard shortcut multiple times to ensure proper toggle behavior

Keyboard Shortcut

  • Shortcut: Meta (Mac) / Ctrl (Windows/Linux) + Shift + .
  • Behavior: Toggles debug overlay on/off
  • State: Persists in localStorage using comet-debugger-mode key
  • Availability: Always enabled for all Opik versions

Files Changed

Frontend

  • apps/opik-frontend/src/components/layout/AppDebugInfo/AppDebugInfo.tsx (new)
  • apps/opik-frontend/src/components/layout/AppNetworkStatus/AppNetworkStatus.tsx (moved from plugins/comet)
  • apps/opik-frontend/src/components/layout/TopBar/TopBar.tsx
  • apps/opik-frontend/src/components/layout/PartialPageLayout/PartialPageLayout.tsx
  • apps/opik-frontend/src/lib/utils.ts (added platform detection utilities)
  • apps/opik-frontend/src/components/pages/SMEFlowPage/hotkeys.ts (uses shared platform detection)

Documentation

  • Activated using keyboard shortcut: Meta/Ctrl + Shift + .
  • Available for all Opik versions (standalone and Comet Cloud)
  • State persists in localStorage with key comet-debugger-mode (compatible with EM)
  • Uses react-hotkeys-hook for keyboard handling
  • Platform detection utilities available in lib/utils.ts for reuse
  • No user documentation needed as this is an internal debugging tool accessible only via keyboard shortcut

- Introduced a new feature toggle for Comet Debugger Mode in the configuration and frontend.
- Added `useIsNetworkOnline` hook to monitor network status.
- Implemented `AppNetworkStatus` component to display network and server connection status.
- Created `UserMenuAppDebugInfoToggle` for toggling debug info visibility in the user menu.
- Updated layouts and components to integrate the new debug features, including `NoUserMenu` and `AppDebugInfo`.
- Added `comet.svg` icon for visual representation.

This commit enhances the debugging capabilities of the application, allowing developers to monitor backend connectivity and toggle debug information visibility.
- Imported Opik icon as a React component in AppDebugInfo.
- Updated the layout to include the icon alongside the OPIK VERSION text for improved visual representation.

This change enhances the user interface by providing a clearer branding element in the debug information section.
- Added 'xs' size variant to the switch component for improved responsiveness.
- Updated UserMenuAppDebugInfoToggle to utilize the new 'xs' size for the debug info switch, enhancing UI consistency.
- Updated the RTT display in the AppNetworkStatus component to use a new class for improved styling, enhancing the visual appeal and consistency of the user interface.
- Introduced a new boolean field `cometDebuggerModeEnabled` in the ServiceTogglesConfig class to manage the debugger mode feature.
- This addition enhances the configuration options available for service toggles, allowing for better control over debugging functionalities.
…splay

- Modified the AppDebugInfo component to only display the OPIK version section if the APP_VERSION is defined, improving the component's robustness and preventing potential rendering issues when the version is not available.
- Modified the end-to-end workflow files to include the `TOGGLE_COMET_DEBUGGER_MODE_ENABLED` environment variable during the build process.
- Updated the `config.yml` to set the default value of `cometDebuggerModeEnabled` to true, enhancing the service toggles configuration.
- Added the `TOGGLE_COMET_DEBUGGER_MODE_ENABLED` variable to the Docker Compose configuration, ensuring it is available in the deployment environment.
@JetoPistola JetoPistola added the test-environment Deploy Opik adhoc environment label Nov 7, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

🔄 Test environment deployment started

Building images for PR #3982...

You can monitor the build progress here.

@CometActions
Copy link
Collaborator

Test environment is now available!

Access Information

The deployment has completed successfully and the version has been verified.

- Updated the UserMenu component to conditionally render the OPIK version section using a logical AND operator instead of a ternary operator, improving code readability and consistency.
@JetoPistola JetoPistola added test-environment Deploy Opik adhoc environment and removed test-environment Deploy Opik adhoc environment labels Nov 7, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

🔄 Test environment deployment started

Building images for PR #3982...

You can monitor the build progress here.

@CometActions
Copy link
Collaborator

Test environment is now available!

Access Information

The deployment has completed successfully and the version has been verified.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

Backend Tests Results

  283 files    283 suites   50m 0s ⏱️
5 421 tests 5 413 ✅ 8 💤 0 ❌
5 409 runs  5 401 ✅ 8 💤 0 ❌

Results for commit 51f169b.

♻️ This comment has been updated with latest results.

@JetoPistola JetoPistola marked this pull request as ready for review November 7, 2025 16:19
@JetoPistola JetoPistola requested review from a team as code owners November 7, 2025 16:19
Copilot AI review requested due to automatic review settings November 7, 2025 16:19
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 implements a Comet Debugger Mode feature that displays app version and network connectivity status for debugging purposes. The feature is controlled by a backend toggle and can be enabled/disabled by users through the UI.

Key Changes:

  • Added backend feature toggle cometDebuggerModeEnabled with environment variable support
  • Created frontend debug UI components showing app version, network status, and backend RTT
  • Integrated debug controls into both user menu and settings menu for different user types

Reviewed Changes

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

Show a summary per file
File Description
deployment/docker-compose/docker-compose.yaml Added environment variable for debugger mode toggle
apps/opik-frontend/src/types/feature-toggles.ts Added COMET_DEBUGGER_MODE_ENABLED feature toggle enum
apps/opik-frontend/src/store/DebugStore.ts Created Zustand store for debug mode state management
apps/opik-frontend/src/plugins/comet/UserMenuAppDebugInfoToggle.tsx Created toggle component for users with menu access
apps/opik-frontend/src/plugins/comet/UserMenu.tsx Integrated debug toggle into existing user menu
apps/opik-frontend/src/plugins/comet/AppNetworkStatus.tsx Created component displaying network and backend connectivity status
apps/opik-frontend/src/hooks/useIsNetworkOnline.ts Added hook to monitor browser network connectivity
apps/opik-frontend/src/components/ui/switch.tsx Added extra-small size variant for Switch component
apps/opik-frontend/src/components/layout/TopBar/TopBar.tsx Integrated debug info display into top navigation
apps/opik-frontend/src/components/layout/SMEPageLayout/SMEPageLayout.tsx Replaced ThemeToggle with NoUserMenu component
apps/opik-frontend/src/components/layout/PartialPageLayout/PartialPageLayout.tsx Added AppDebugInfo and replaced ThemeToggle with NoUserMenu
apps/opik-frontend/src/components/layout/NoUserMenu.tsx Created settings menu for users without full menu access
apps/opik-frontend/src/components/layout/AppDebugInfo/AppDebugInfo.tsx Created main debug info overlay component
apps/opik-frontend/src/components/feature-toggles-provider.tsx Added default state for new feature toggle
apps/opik-frontend/src/api/debug/useIsAlive.ts Created API hook for backend health checks with RTT calculation
apps/opik-backend/src/main/java/com/comet/opik/infrastructure/ServiceTogglesConfig.java Added backend configuration field for debugger mode
apps/opik-backend/config.yml Added configuration entry with environment variable support
.github/workflows/end2end_suites_typescript.yml Disabled debugger mode in E2E tests
.github/workflows/end2end_suites.yml Disabled debugger mode in E2E tests

@JetoPistola JetoPistola marked this pull request as draft November 9, 2025 04:18
…oggles

- Add Meta/Ctrl + c + . keyboard shortcut to toggle debugger mode
- Remove UserMenuAppDebugInfoToggle from UserMenu and NoUserMenu
- Debugger mode now controlled exclusively via keyboard shortcut
@JetoPistola JetoPistola removed request for a team November 9, 2025 14:14
@JetoPistola JetoPistola added test-environment Deploy Opik adhoc environment and removed test-environment Deploy Opik adhoc environment labels Nov 9, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2025

🔄 Test environment deployment started

Building images for PR #3982...

You can monitor the build progress here.

@CometActions
Copy link
Collaborator

Test environment is now available!

Access Information

The deployment has completed successfully and the version has been verified.

@JetoPistola JetoPistola marked this pull request as ready for review November 9, 2025 15:07
@JetoPistola JetoPistola requested a review from aadereiko November 9, 2025 15:07
…available for all versions

- Replace manual keyboard event handling with useHotkeys hook
- Change hotkey to Cmd/Ctrl+Shift+. to avoid conflict with system copy command
- Extract platform detection (isMac, modifierKey) to shared utils
- Move AppDebugInfo and AppNetworkStatus from plugins/comet to components/shared
- Update AppNetworkStatus to use generic 'backend server' terminology instead of 'Comet server'
- Maintain same localStorage key (comet-debugger-mode) for consistency with EM
Copy link
Contributor

@andriidudar andriidudar 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 — thanks for addressing all the comments! 🙌

@JetoPistola JetoPistola merged commit 7e0fc35 into main Nov 10, 2025
9 checks passed
@JetoPistola JetoPistola deleted the danield/OPIK-2848-comet-debugger-mode branch November 10, 2025 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend test-environment Deploy Opik adhoc environment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants