8000 chore: record and raise problematic http protocols for each proxy by Emyrk · Pull Request #15917 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

chore: record and raise problematic http protocols for each proxy #15917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update language
  • Loading branch information
Emyrk committed Dec 18, 2024
commit b20a0a3588dee1aa0c5e72ac2c5590da29545da6
1 change: 1 addition & 0 deletions site/src/contexts/useProxyLatency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface ProxyLatencyReport {
// at is when the latency was recorded.
at: Date;
// nextHopProtocol can determine if HTTP/2 is being used.
// https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/nextHopProtocol
nextHopProtocol?: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,27 @@ export const ProxyRow: FC<ProxyRowProps> = ({ proxy, latency }) => {
// All users can see healthy/unhealthy, some can see more.
let statusBadge = <ProxyStatus proxy={proxy} />;
let shouldShowMessages = false;
let extraWarnings: string[] = [];
if (latency?.nextHopProtocol) {
switch (latency.nextHopProtocol) {
case "http/0.9":
case "http/1.0":
case "http/1.1":
extraWarnings.push(
`Requests to the proxy are using ${latency.nextHopProtocol}, and the server does not support HTTP/2. ` +
`For usability reasons, HTTP/2 or above is recommended. ` +
`Pages may fail to load if the web browser's concurrent connection limit is reached.`,
);
}
}

if ("status" in proxy) {
const wsproxy = proxy as WorkspaceProxy;
statusBadge = <DetailedProxyStatus proxy={wsproxy} />;
shouldShowMessages = Boolean(
(wsproxy.status?.report?.warnings &&
wsproxy.status?.report?.warnings.length > 0) ||
extraWarnings.length > 0 ||
(wsproxy.status?.report?.errors &&
wsproxy.status?.report?.errors.length > 0),
);
Expand Down Expand Up @@ -84,7 +99,10 @@ export const ProxyRow: FC<ProxyRowProps> = ({ proxy, latency }) => {
colSpan={4}
css={{ padding: "0 !important", borderBottom: 0 }}
>
<ProxyMessagesRow proxy={proxy as WorkspaceProxy} />
<ProxyMessagesRow
proxy={proxy as WorkspaceProxy}
extraWarnings={extraWarnings}
/>
</TableCell>
</TableRow>
)}
Expand All @@ -94,9 +112,13 @@ export const ProxyRow: FC<ProxyRowProps> = ({ proxy, latency }) => {

interface ProxyMessagesRowProps {
proxy: WorkspaceProxy;
extraWarnings: string[];
}

const ProxyMessagesRow: FC<ProxyMessagesRowProps> = ({ proxy }) => {
const ProxyMessagesRow: FC<ProxyMessagesRowProps> = ({
proxy,
extraWarnings,
}) => {
const theme = useTheme();

return (
Expand All @@ -109,7 +131,7 @@ const ProxyMessagesRow: FC<ProxyMessagesRowProps> = ({ proxy }) => {
title={
<span css={{ color: theme.palette.warning.light }}>Warnings</span>
}
messages={proxy.status?.report?.warnings}
messages={proxy.status?.report?.warnings.concat(extraWarnings)}
/>
</>
);
Expand Down
Loading
0