-
Notifications
You must be signed in to change notification settings - Fork 207
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
Fix issues with PerformanceReport Page (commit data, hiding missing data) #1461
base: performance-benchmark-page
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,14 +7,22 @@ import { TRANSACTION_PER_MINUTE } from '../../common/Constant'; | |
import { usePageEffect } from '../../core/page'; | ||
import { PerformanceTable } from '../../core/table'; | ||
import { UseCaseData } from './data'; | ||
import { GetLatestPerformanceReports, GetServiceLatestVersion } from './service'; | ||
import { GetLatestPerformanceReports, GetServiceLatestVersion, GetServicePRInformation } from './service'; | ||
import { PasswordDialog } from '../../common/Dialog'; | ||
import { SelectChangeEvent } from '@mui/material/Select'; | ||
|
||
export default function PerformanceReport(props: { password: string; password_is_set: boolean; set_password_state: any }): JSX.Element { | ||
usePageEffect({ title: 'Amazon CloudWatch Agent' }); | ||
const { password, password_is_set, set_password_state } = props; | ||
const [{ version, commit_date, commit_title, commit_hash, commit_url, use_cases, ami_id, collection_period }] = useStatePerformanceReport(password); | ||
const [{ data_type }, setDataTypeState] = useStateDataType(); | ||
|
||
const handleDataTypeChange = (event: SelectChangeEvent) => { | ||
setDataTypeState({ data_type: event.target.value }); | ||
}; | ||
|
||
const selectedUseCaseData: UseCaseData[] = use_cases.filter((useCase: UseCaseData) => useCase?.data_type?.toLowerCase() === data_type.toLowerCase()); | ||
|
||
return ( | ||
<Container> | ||
<PasswordDialog password={password} password_is_set={password_is_set} set_password_state={set_password_state} /> | ||
|
@@ -89,19 +97,7 @@ export default function PerformanceReport(props: { password: string; password_is | |
) : name === 'Commit Date' ? ( | ||
<Typography variant="h4">{commit_date}</Typography> | ||
) : ( | ||
<Select | ||
sx={{ height: '41px' }} | ||
value={data_type} | ||
onChange={(e: { | ||
target: { | ||
value: string; | ||
}; | ||
}) => | ||
setDataTypeState({ | ||
data_type: e.target.value, | ||
}) | ||
} | ||
> | ||
<Select sx={{ height: '41px' }} value={data_type} onChange={handleDataTypeChange}> | ||
<MenuItem value={'Metrics'}>Metric</MenuItem> | ||
<MenuItem value={'Traces'}>Trace</MenuItem> | ||
<MenuItem value={'Logs'}>Logs</MenuItem> | ||
|
@@ -120,7 +116,7 @@ export default function PerformanceReport(props: { password: string; password_is | |
<Typography sx={{ mb: 2, fontWeight: 'bold' }} variant="h3"> | ||
{data_type} (TPM: {tpm}){' '} | ||
</Typography> | ||
<PerformanceTable data_rate={String(tpm)} use_cases={use_cases.filter((use_case: UseCaseData) => use_case?.data_type === data_type.toLowerCase())} /> | ||
<PerformanceTable key={data_type} data_rate={String(tpm)} use_cases={selectedUseCaseData} /> | ||
</Container> | ||
))} | ||
</Container> | ||
|
@@ -166,7 +162,7 @@ function useStatePerformanceReport(password: string) { | |
name: pReport?.UseCase.S, | ||
data_type: pReport?.DataType.S, | ||
instance_type: pReport?.InstanceType.S, | ||
data: TRANSACTION_PER_MINUTE.reduce( | ||
data: Object.keys(pReport?.Results.M).reduce( | ||
(accu, tpm) => ({ | ||
...accu, | ||
[tpm]: { | ||
|
@@ -187,19 +183,18 @@ function useStatePerformanceReport(password: string) { | |
), | ||
}); | ||
} | ||
// const commit_info = await GetServicePRInformation(password, commit_hash); | ||
|
||
const commit_info = await GetServicePRInformation(password, commit_hash); | ||
|
||
setState((prev: any) => ({ | ||
...prev, | ||
version: service_info.tag_name, | ||
ami_id: ami_id, | ||
collection_period: collection_period, | ||
use_cases: use_cases, | ||
// commit_title: `${commit_info?.title} (#${commit_info?.number})`, | ||
// commit_url: commit_info?.html_url, | ||
commit_title: `${commit_info?.title} (#${commit_info?.number})`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we add default fallbacks here to make sure it doesn't break |
||
commit_url: commit_info?.html_url, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we add default fallbacks here to make sure it doesn't break |
||
commit_hash: commit_hash, | ||
commit_title: `PlaceHolder`, | ||
commit_url: `www.github.com/aws/amazon-cloudwatch-agent`, | ||
commit_date: moment.unix(Number(commit_date)).format('dddd, MMMM Do, YYYY h:mm:ss A'), | ||
})); | ||
})(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -189,10 +189,10 @@ export default function PerformanceTrend(props: { password: string; password_is_ | |
const selected_data = series[seriesIndex][dataPointIndex]; | ||
const selected_hash = w.globals.categoryLabels[dataPointIndex]; | ||
const selected_hash_information: ServiceCommitInformation | undefined = commits_information | ||
.filter((c: ServiceCommitInformation) => c.sha === selected_hash) | ||
.filter((c: ServiceCommitInformation) => c.sha.startsWith(selected_hash)) | ||
.at(0); | ||
const commit_history = selected_hash_information?.commit.message.replace(/\n\r*\n*/g, '<br />'); | ||
const commited_by = `Committed by ${selected_hash_information?.author.login} on ${selected_hash_information?.author.date}`; | ||
const commited_by = `Committed by ${selected_hash_information?.author.login} on ${selected_hash_information?.commit?.author?.date}`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we add default fallbacks here to make sure it doesn't break |
||
const commit_data = `<b>${use_case}</b>: ${selected_data}`; | ||
|
||
return ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,21 +154,23 @@ export function PerformanceTable(props: { use_cases: UseCaseData[]; data_rate: s | |
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
{use_cases?.map((use_case) => ( | ||
<StyledTableRow key={use_case.name}> | ||
<StyledTableCell>{use_case.name}</StyledTableCell> | ||
<StyledTableCell>{use_case.instance_type}</StyledTableCell> | ||
<StyledTableCell>{Number(use_case.data?.[data_rate]?.procstat_cpu_usage).toFixed(2)}</StyledTableCell> | ||
<StyledTableCell>{(Number(use_case.data?.[data_rate]?.procstat_memory_rss) / Number(use_case.data?.[data_rate]?.mem_total)).toFixed(2)}</StyledTableCell> | ||
<StyledTableCell>{(Number(use_case.data?.[data_rate]?.procstat_memory_swap) / Number(use_case.data?.[data_rate]?.mem_total)).toFixed(2)}</StyledTableCell> | ||
<StyledTableCell>{(Number(use_case.data?.[data_rate]?.procstat_memory_data) / Number(use_case.data?.[data_rate]?.mem_total)).toFixed(2)}</StyledTableCell> | ||
<StyledTableCell>{(Number(use_case.data?.[data_rate]?.procstat_memory_vms) / Number(use_case.data?.[data_rate]?.mem_total)).toFixed(2)}</StyledTableCell> | ||
<StyledTableCell>{Number(use_case.data?.[data_rate]?.procstat_write_bytes).toFixed(2)}</StyledTableCell> | ||
<StyledTableCell>{Number(use_case.data?.[data_rate]?.procstat_num_fds).toFixed(2)}</StyledTableCell> | ||
<StyledTableCell>{Number(use_case.data?.[data_rate]?.net_bytes_sent).toFixed(2)}</StyledTableCell> | ||
<StyledTableCell>{Number(use_case.data?.[data_rate]?.net_packets_sent).toFixed(2)}</StyledTableCell> | ||
</StyledTableRow> | ||
))} | ||
{use_cases?.map((use_case: UseCaseData) => { | ||
return use_case.data?.[data_rate] ? ( | ||
<StyledTableRow key={use_case.name}> | ||
<StyledTableCell>{use_case.name}</StyledTableCell> | ||
<StyledTableCell>{use_case.instance_type}</StyledTableCell> | ||
<StyledTableCell>{Number(use_case.data?.[data_rate]?.procstat_cpu_usage).toFixed(2)}</StyledTableCell> | ||
<StyledTableCell>{(Number(use_case.data?.[data_rate]?.procstat_memory_rss) / Number(use_case.data?.[data_rate]?.mem_total)).toFixed(2)}</StyledTableCell> | ||
<StyledTableCell>{(Number(use_case.data?.[data_rate]?.procstat_memory_swap) / Number(use_case.data?.[data_rate]?.mem_total)).toFixed(2)}</StyledTableCell> | ||
<StyledTableCell>{(Number(use_case.data?.[data_rate]?.procstat_memory_data) / Number(use_case.data?.[data_rate]?.mem_total)).toFixed(2)}</StyledTableCell> | ||
<StyledTableCell>{(Number(use_case.data?.[data_rate]?.procstat_memory_vms) / Number(use_case.data?.[data_rate]?.mem_total)).toFixed(2)}</StyledTableCell> | ||
<StyledTableCell>{Number(use_case.data?.[data_rate]?.procstat_write_bytes).toFixed(2)}</StyledTableCell> | ||
<StyledTableCell>{Number(use_case.data?.[data_rate]?.procstat_num_fds).toFixed(2)}</StyledTableCell> | ||
<StyledTableCell>{Number(use_case.data?.[data_rate]?.net_bytes_sent).toFixed(2)}</StyledTableCell> | ||
<StyledTableCell>{Number(use_case.data?.[data_rate]?.net_packets_sent).toFixed(2)}</StyledTableCell> | ||
</StyledTableRow> | ||
) : null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it better to return null than |
||
})} | ||
</TableBody> | ||
</Table> | ||
</TableContainer> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this based on can we document it? can we also document that this is in milli seconds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trends page often runs into a timeout when collecting commit data.
Will update this to add retry/show an error page as well.