Skip to content

Cluster Dashboard health check: pause when hidden, back off and stop after failures #1091

Open

Description

The Cluster Dashboard health check polls the cluster every 5 seconds (ping plus serverStatus) for as long as the dashboard is open. Telemetry from 19 Oct to 15 Nov 2026 shows it keeps running far longer than intended and never gives up after failures. We plan to rework the health check in general for 1.2.0; this issue collects what the data showed so that work can address it in one go.

What we observed

  • It runs while nobody is looking. The poll has a visibility pause (ClusterDashboard.tsx, document.visibilityState), but 57% of the poll-driven telemetry batches came from uninterrupted runs of 8 hours or more, and 36% from runs of 24 hours or more (the longest was 362 hours). Inside a webview, document.visibilityState most likely follows the VS Code window, not the editor tab, so a dashboard in a background tab keeps polling. (Hypothesis, consistent with the data.)
  • It never stops after failures. A failed tick only increments consecutiveFailures; the next tick calls getClient(..., 'clusterDashboardPoll') again. With missing or evicted credentials, every tick starts a new connection attempt that fails at stage 1 (preparing credentials). We see 20 machines with 4,644 such failures, roughly one every 5 seconds. 1.1.0 records startupTrigger, which will confirm whether these come from clusterDashboardPoll.
  • It is most of our server traffic. On Azure DocumentDB, Cluster Dashboard pings were about 97% of the requests the extension sent (server-side telemetry, which covers only part of Azure DocumentDB).
  • It was also the main driver of the documentDB.webview.rpcConcurrency telemetry event (about 65% of all extension events), which is removed in 1.1.0 (PR Telemetry cleanup and health monitoring for 1.1.0 #1064, commit da13a7f).

Suggested changes

  • Pause polling based on the panel's own visibility (WebviewPanel.visible / onDidChangeViewState, already used by the dashboard's lifetime telemetry), pushed to the webview or checked by measureRtt, instead of document.visibilityState. Consider a slower interval while the VS Code window is not focused.
  • Back off after failures (for example 5 s, 10 s, 20 s, 60 s).
  • After 2-3 credential or authentication failures, stop polling and show a reconnect action instead of starting new connection attempts.
  • Revisit the 5-second interval itself (each tick is two server commands).
  • After shipping, confirm in telemetry that connect.startup failures with startupTrigger = clusterDashboardPoll drop and that the dashboard's share of server requests falls.

Pointers

  • src/commands/openClusterDashboard/openClusterDashboard.ts (poll interval)
  • src/webviews/documentdb/clusterDashboard/ClusterDashboard.tsx (poll loop and visibility pause)
  • src/webviews/documentdb/clusterDashboard/clusterDashboardRouter.ts (measureRtt, getClient(..., 'clusterDashboardPoll'))
  • src/documentdb/utils/getClusterHealth.ts (ping + serverStatus, failure counting)
  • Telemetry analysis: docs/ai-and-plans/dashboards/lessons-learned.md (dashboards branch) and the 2026-11-16 investigation of rpcConcurrency.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions