Skip to content

Commit

Permalink
Handle timeouts in frontend config (#238)
Browse files Browse the repository at this point in the history
* fix: Ensure provisioned timeouts are respected in frontend config

* test: Use a shorter window of 30m in e2e test for Prom DS. Use selected panels to render in e2e tests. Render only selected panels

---------

Signed-off-by: Mahendra Paipuri <[email protected]>
  • Loading branch information
mahendrapaipuri authored Jan 16, 2025
1 parent 29fc8e1 commit 554e503
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .ci/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ services:
- RENDERING_MODE=clustered
- RENDERING_CLUSTERING_MODE=browser
- RENDERING_CLUSTERING_MAX_CONCURRENCY=5
- RENDERING_CLUSTERING_TIMEOUT=60
- RENDERING_CLUSTERING_TIMEOUT=600
- IGNORE_HTTPS_ERRORS=true

chrome_plain:
Expand Down Expand Up @@ -135,7 +135,7 @@ services:
- RENDERING_MODE=clustered
- RENDERING_CLUSTERING_MODE=browser
- RENDERING_CLUSTERING_MAX_CONCURRENCY=5
- RENDERING_CLUSTERING_TIMEOUT=60
- RENDERING_CLUSTERING_TIMEOUT=600
- IGNORE_HTTPS_ERRORS=true

chrome_tls:
Expand Down
7 changes: 5 additions & 2 deletions scripts/e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ DASH_UID="b3228ada-fd89-4aed-8605-d5f7b95aa237"
# CLI ARGS
VARIANT="$1"

# Panels to render
PANELS="includePanelID=1&includePanelID=5"

if [[ "$VARIANT" == "plain" ]]; then
GRAFANA_PROTOCOL="http"
GRAFANA_PORT="3080"
QUERY_PARAMS='from=now-60d&to=now&var-job=$__all&var-instance=$__all&var-interval=1h&var-ds=PBFA97CFB590B2093&layout=simple&orientation=portrait&dashboardMode=default'
QUERY_PARAMS="from=now-30m&to=now&var-job=$__all&var-instance=$__all&var-interval=1h&var-ds=PBFA97CFB590B2093&layout=simple&orientation=portrait&dashboardMode=default&$PANELS"
REPORT_NAME="default"
else
GRAFANA_PROTOCOL="https"
GRAFANA_PORT="3443"
QUERY_PARAMS='from=now-60d&to=now&var-job=$__all&var-instance=$__all&var-interval=1h&var-ds=PBFA97CFB590B2093&layout=grid&orientation=landscape&dashboardMode=full'
QUERY_PARAMS="from=now-30m&to=now&var-job=$__all&var-instance=$__all&var-interval=1h&var-ds=PBFA97CFB590B2093&layout=grid&orientation=landscape&dashboardMode=full&$PANELS"
REPORT_NAME="alternative"
fi

Expand Down
49 changes: 49 additions & 0 deletions src/components/AppConfig/AppConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ export type JsonData = {
maxBrowserWorkers?: number;
maxRenderWorkers?: number;
remoteChromeUrl?: string;
timeout?: number;
dialTimeout?: number;
httpKeepAlive?: number;
httpTLSHandshakeTimeout?: number;
httpIdleConnTimeout?: number;
httpMaxConnsPerHost?: number;
httpMaxIdleConns?: number;
httpMaxIdleConnsPerHost?: number;
};

type State = {
Expand Down Expand Up @@ -107,6 +115,15 @@ type State = {
saToken: string;
// If the service has been reset
isSaTokenReset: boolean;
// Timemouts
timeout: number;
dialTimeout: number;
httpKeepAlive: number;
httpTLSHandshakeTimeout: number;
httpIdleConnTimeout: number;
httpMaxConnsPerHost: number;
httpMaxIdleConns: number;
httpMaxIdleConnsPerHost: number;
};

interface Props extends PluginConfigPageProps<AppPluginMeta<JsonData>> {}
Expand Down Expand Up @@ -147,6 +164,14 @@ export const AppConfig = ({ plugin }: Props) => {
saToken: "",
isSaTokenSet: Boolean(secureJsonFields?.saToken),
isSaTokenReset: false,
timeout: jsonData?.timeout || 30,
dialTimeout: jsonData?.dialTimeout || 10,
httpKeepAlive: jsonData?.httpKeepAlive || 30,
httpTLSHandshakeTimeout: jsonData?.httpTLSHandshakeTimeout || 10,
httpIdleConnTimeout: jsonData?.httpIdleConnTimeout || 90,
httpMaxConnsPerHost: jsonData?.httpMaxConnsPerHost || 0,
httpMaxIdleConns: jsonData?.httpMaxIdleConns || 100,
httpMaxIdleConnsPerHost: jsonData?.httpMaxIdleConnsPerHost || 100,
});

const themeOptions = [
Expand Down Expand Up @@ -328,6 +353,14 @@ export const AppConfig = ({ plugin }: Props) => {
maxBrowserWorkers: state.maxBrowserWorkers,
maxRenderWorkers: state.maxRenderWorkers,
remoteChromeUrl: state.remoteChromeUrl,
timeout: state.timeout,
dialTimeout: state.dialTimeout,
httpKeepAlive: state.httpKeepAlive,
httpTLSHandshakeTimeout: state.httpTLSHandshakeTimeout,
httpIdleConnTimeout: state.httpIdleConnTimeout,
httpMaxConnsPerHost: state.httpMaxConnsPerHost,
httpMaxIdleConns: state.httpMaxIdleConns,
httpMaxIdleConnsPerHost: state.httpMaxIdleConnsPerHost,
},
// This cannot be queried later by the frontend.
// We don't want to override it in case it was set previously and left untouched now.
Expand Down Expand Up @@ -371,6 +404,14 @@ export const AppConfig = ({ plugin }: Props) => {
maxBrowserWorkers: state.maxBrowserWorkers,
maxRenderWorkers: state.maxRenderWorkers,
remoteChromeUrl: state.remoteChromeUrl,
timeout: state.timeout,
dialTimeout: state.dialTimeout,
httpKeepAlive: state.httpKeepAlive,
httpTLSHandshakeTimeout: state.httpTLSHandshakeTimeout,
httpIdleConnTimeout: state.httpIdleConnTimeout,
httpMaxConnsPerHost: state.httpMaxConnsPerHost,
httpMaxIdleConns: state.httpMaxIdleConns,
httpMaxIdleConnsPerHost: state.httpMaxIdleConnsPerHost,
},
// This cannot be queried later by the frontend.
// We don't want to override it in case it was set previously and left untouched now.
Expand Down Expand Up @@ -685,6 +726,14 @@ export const AppConfig = ({ plugin }: Props) => {
maxBrowserWorkers: state.maxBrowserWorkers,
maxRenderWorkers: state.maxRenderWorkers,
remoteChromeUrl: state.remoteChromeUrl,
timeout: state.timeout,
dialTimeout: state.dialTimeout,
httpKeepAlive: state.httpKeepAlive,
httpTLSHandshakeTimeout: state.httpTLSHandshakeTimeout,
httpIdleConnTimeout: state.httpIdleConnTimeout,
httpMaxConnsPerHost: state.httpMaxConnsPerHost,
httpMaxIdleConns: state.httpMaxIdleConns,
httpMaxIdleConnsPerHost: state.httpMaxIdleConnsPerHost,
},
// This cannot be queried later by the frontend.
// We don't want to override it in case it was set previously and left untouched now.
Expand Down

0 comments on commit 554e503

Please sign in to comment.