feat: add network slowness detection with configurable threshold#891
Open
feat: add network slowness detection with configurable threshold#891
Conversation
814b25e to
9187650
Compare
Extract status bar presentation and threshold logic into networkStatus.ts with a NetworkStatusReporter class. SshProcessMonitor delegates status bar updates to the reporter. Warn users when latency, download, or upload cross configurable thresholds (debounced over 3 consecutive polls). Clicking the warning runs relevant diagnostics. Tooltip shows live metrics with codicons and a link to configure thresholds.
The download_bytes_sec/upload_bytes_sec fields from the Coder CLI measure actual tunnel traffic during the poll window, not link capacity. Idle SSH sessions always dipped below the 5 Mbps default even on fast networks, producing spurious warnings. Keep latency as the only slowness signal. Display throughput in the tooltip as informational data only. Replace the warning-icon-mid-line layout with a bold header, tight metric rows, and an action row containing explicit Ping workspace and Configure threshold links.
411f5f8 to
9e4101d
Compare
- Extract connection label/summary helpers; treat Coder Connect as a first-class case (early-return tooltip, explicit warning suppression) since the CLI only sets the flag and leaves stats at zero. - Debounce warning state over 2 consecutive polls (down from 3); drop getThresholdConfig and isLatencySlow exports, inline both. - Tooltip leads with a friendly connection summary, keeps action links only when the warning fires, and appends a stale-data footer. - Rename MockStatusBar to MockStatusBarItem and have it implement the vscode.StatusBarItem interface; remove the 'as unknown' cast from call sites. - Share makeNetworkInfo fixture between network and ssh process tests. - Bump default latency threshold from 200ms to 250ms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
coder.networkThreshold.latencyMs(default 250ms, set to0to disable) that triggers a yellow status-bar warning when the workspace connection latency crosses the threshold.coder.pingWorkspace(latency diagnostic); tooltip action links also offer direct shortcuts to the ping command and the settings entry for the threshold.Tooltip layout
$(zap) Directly connected peer-to-peer.$(broadcast) Connected via <DERP> relay. Will switch to peer-to-peer when available.(preserves the helpful fallback note from the old tooltip)using_coder_connect: trueand leaves latency/throughput at zero, so the tooltip doesn't render empty metric lines and warnings are suppressed for this path.$(warning) Slow connection detectedheader + action links ("Run latency test", "Configure threshold").(~50ms)) +$(history)footer in the tooltip.Closes #887