-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
208 additions
and
61 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export const SPLUNK_BASE_URL = | ||
"https://rhcorporate.splunkcloud.com/en-GB/app/search/"; | ||
|
||
export const BENCHMARK_URL = { | ||
cyclictest: "cyclictest_kpis", | ||
cpu_util: "cpu_util_kpis", | ||
deployment: "deployment_kpis", | ||
oslat: "oslat_kpis", | ||
ptp: "ptp_kpis", | ||
reboot: "reboot_kpis", | ||
"rfc-2544": "rfc2544_", | ||
}; | ||
|
||
export const THRESHOLD_VALUE = 0.03; | ||
export const CPU_UTIL_QUERY = `form.high_cpu_treshhold=${THRESHOLD_VALUE}&form.selected_duration=*`; | ||
export const CHART_COMPARISON_QUERY = `form.charts_comparison=ocp_version`; | ||
export const OCP_VIEW_QUERY = `form.ocp_view=ocp_version`; | ||
export const REBOOT_QUERY = `form.reboot_type=soft_reboot`; | ||
|
||
export const BUBBLE_CHART_LEGEND_QUERY = "form.bubble_chart_legend="; | ||
export const RFC_LEGEND_VALUE = "kernel"; | ||
export const PTP_LEGEND_VALUE = "ocp_build"; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import * as CONSTANTS from "@/assets/constants/grafanaConstants"; | ||
|
||
import GrafanaIcon from "@/assets/images/grafana-icon.png"; | ||
import LinkIcon from "@/components/atoms/LinkIcon"; | ||
import Proptypes from "prop-types"; | ||
import { useMemo } from "react"; | ||
|
||
const GrafanaLink = (props) => { | ||
const { config, startDate, endDate } = props; | ||
const grafanaLink = useMemo(() => { | ||
const ciSystem_lCase = config.ciSystem?.toLowerCase(); | ||
const isProw = ciSystem_lCase === "prow"; | ||
const discreteBenchmark = | ||
CONSTANTS.ciSystemMap[ciSystem_lCase]?.[ciSystem_lCase?.benchmark]; | ||
|
||
const hasBenchmark = Object.prototype.hasOwnProperty.call( | ||
CONSTANTS.ciSystemMap?.[ciSystem_lCase], | ||
config.benchmark | ||
); | ||
const datasource = isProw | ||
? CONSTANTS.PROW_DATASOURCE | ||
: hasBenchmark | ||
? discreteBenchmark?.dataSource | ||
: CONSTANTS.DEFAULT_DATASOURCE; | ||
|
||
const dashboardURL = | ||
discreteBenchmark?.dashboardURL ?? CONSTANTS.DASHBOARD_KUBE_BURNER; | ||
|
||
const datePart = `&from=${startDate}&to=${endDate}`; | ||
const uuidPart = `&var-uuid=${config.uuid}`; | ||
|
||
if (config.benchmark === CONSTANTS.QUAY_LOAD_TEST) | ||
return `${CONSTANTS.GRAFANA_BASE_URL}${CONSTANTS.DASHBOARD_QUAY}${datePart}${uuidPart}`; | ||
return `${CONSTANTS.GRAFANA_BASE_URL}${dashboardURL}${datasource}${datePart}&var-platform=${config.platform}"&var-workload=${config.benchmark}${uuidPart}`; | ||
}, [ | ||
config.benchmark, | ||
config.ciSystem, | ||
config.platform, | ||
config.uuid, | ||
endDate, | ||
startDate, | ||
]); | ||
|
||
return ( | ||
<LinkIcon | ||
link={grafanaLink} | ||
target={"_blank"} | ||
src={GrafanaIcon} | ||
altText={"grafana link"} | ||
height={30} | ||
width={30} | ||
/> | ||
); | ||
}; | ||
|
||
GrafanaLink.propTypes = { | ||
config: Proptypes.object, | ||
endDate: Proptypes.number, | ||
startDate: Proptypes.number, | ||
}; | ||
|
||
export default GrafanaLink; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import * as CONSTANTS from "@/assets/constants/splunkConstants"; | ||
|
||
import LinkIcon from "@/components/atoms/LinkIcon"; | ||
import Proptypes from "prop-types"; | ||
import SplunkIcon from "@/assets/images/splunk-icon.png"; | ||
import { useMemo } from "react"; | ||
|
||
const CONSTANTSLink = (props) => { | ||
const { config, startDate, endDate } = props; | ||
const splunkLink = useMemo(() => { | ||
const url = `${CONSTANTS.SPLUNK_BASE_URL}${ | ||
CONSTANTS.BENCHMARK_URL[config.benchmark] | ||
}`; | ||
|
||
const query = `form.global_time.earliest=${encodeURIComponent( | ||
new Date(startDate).toISOString() | ||
)}&form.global_time.latest=${encodeURIComponent( | ||
new Date(endDate).toISOString() | ||
)}&form.formal_tag=${encodeURIComponent( | ||
config.formal | ||
)}&form.ocp_version=${encodeURIComponent( | ||
config.shortVersion | ||
)}&&form.ocp_build=${encodeURIComponent( | ||
config.ocpVersion | ||
)}&form.node_name=${encodeURIComponent(config.nodeName)}& | ||
&form.general_statistics=${encodeURIComponent(config.shortVersion)}`; | ||
|
||
const kernelQuery = `form.dashboard_kernels=${encodeURIComponent( | ||
config.kernel | ||
)}`; | ||
|
||
const histogramQuery = `form.histogram=${encodeURIComponent( | ||
config.ocpVersion | ||
)}`; | ||
|
||
switch (config.benchmark) { | ||
case "cyclictest": { | ||
return `${url}?${query}&${CONSTANTS.OCP_VIEW_QUERY}&${kernelQuery}`; | ||
} | ||
case "cpu_util": { | ||
return `${url}?${query}&${CONSTANTS.CPU_UTIL_QUERY}&${kernelQuery}`; | ||
} | ||
case "deployment": { | ||
return `${url}?${query}`; | ||
} | ||
case "oslat": { | ||
return `${url}?${query}&${CONSTANTS.OCP_VIEW_QUERY}&${CONSTANTS.CHART_COMPARISON_QUERY}&${kernelQuery}`; | ||
} | ||
case "ptp": { | ||
return `${url}?${query}&${CONSTANTS.BUBBLE_CHART_LEGEND_QUERY}${CONSTANTS.PTP_LEGEND_VALUE}&${kernelQuery}`; | ||
} | ||
case "reboot": { | ||
return `${url}?${query}&${CONSTANTS.CHART_COMPARISON_QUERY}&${CONSTANTS.REBOOT_QUERY}&${kernelQuery}`; | ||
} | ||
case "rfc-2544": { | ||
return `${url}?${query}&${CONSTANTS.BUBBLE_CHART_LEGEND_QUERY}${CONSTANTS.RFC_LEGEND_VALUE}&${histogramQuery}&${kernelQuery}`; | ||
} | ||
} | ||
}, [ | ||
config.benchmark, | ||
config.formal, | ||
config.kernel, | ||
config.nodeName, | ||
config.ocpVersion, | ||
config.shortVersion, | ||
endDate, | ||
startDate, | ||
]); | ||
|
||
return ( | ||
<LinkIcon | ||
link={splunkLink} | ||
target={"_blank"} | ||
src={SplunkIcon} | ||
altText={"splunk link"} | ||
height={30} | ||
width={30} | ||
/> | ||
); | ||
}; | ||
|
||
CONSTANTSLink.propTypes = { | ||
config: Proptypes.object, | ||
endDate: Proptypes.number, | ||
startDate: Proptypes.number, | ||
}; | ||
export default CONSTANTSLink; |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.info-wrapper { | ||
display: flex; | ||
justify-content: space-between; | ||
width: 50%; | ||
justify-content: space-evenly; | ||
width: 35%; | ||
} |