mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
# Backport This will backport the following commits from `main` to `9.0`: - [[Synthetics] Fix lat test run timestamp !! (#213735)](https://github.com/elastic/kibana/pull/213735) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Shahzad","email":"shahzad31comp@gmail.com"},"sourceCommit":{"committedDate":"2025-03-11T15:01:09Z","message":"[Synthetics] Fix lat test run timestamp !! (#213735)\n\n## Summary\n\n Fix lat test run timestamp !!\n\nIssue was because of using timestamp abstraction on the ping document.\n\n### Changes\nremoved the unnecessary timestamp field from ping and use `@timestamp`\nwhich is natively present on the document. it was causing unnecessary\nconfusion.\n\nFixes https://github.com/elastic/kibana/issues/213742 !!\n\n\n### Before\n<img width=\"1487\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/ce03e52d-2287-4b30-b984-07a1a8690dff\"\n/>\n\n\n### After\n<img width=\"1478\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/149694d8-8f49-4444-bf3b-edf8fe914741\"\n/>","sha":"60ccd5805fd2d504e05794826defa19bb86f7d0c","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:obs-ux-management","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[Synthetics] Fix lat test run timestamp !!","number":213735,"url":"https://github.com/elastic/kibana/pull/213735","mergeCommit":{"message":"[Synthetics] Fix lat test run timestamp !! (#213735)\n\n## Summary\n\n Fix lat test run timestamp !!\n\nIssue was because of using timestamp abstraction on the ping document.\n\n### Changes\nremoved the unnecessary timestamp field from ping and use `@timestamp`\nwhich is natively present on the document. it was causing unnecessary\nconfusion.\n\nFixes https://github.com/elastic/kibana/issues/213742 !!\n\n\n### Before\n<img width=\"1487\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/ce03e52d-2287-4b30-b984-07a1a8690dff\"\n/>\n\n\n### After\n<img width=\"1478\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/149694d8-8f49-4444-bf3b-edf8fe914741\"\n/>","sha":"60ccd5805fd2d504e05794826defa19bb86f7d0c"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/213735","number":213735,"mergeCommit":{"message":"[Synthetics] Fix lat test run timestamp !! (#213735)\n\n## Summary\n\n Fix lat test run timestamp !!\n\nIssue was because of using timestamp abstraction on the ping document.\n\n### Changes\nremoved the unnecessary timestamp field from ping and use `@timestamp`\nwhich is natively present on the document. it was causing unnecessary\nconfusion.\n\nFixes https://github.com/elastic/kibana/issues/213742 !!\n\n\n### Before\n<img width=\"1487\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/ce03e52d-2287-4b30-b984-07a1a8690dff\"\n/>\n\n\n### After\n<img width=\"1478\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/149694d8-8f49-4444-bf3b-edf8fe914741\"\n/>","sha":"60ccd5805fd2d504e05794826defa19bb86f7d0c"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Shahzad <shahzad31comp@gmail.com>
This commit is contained in:
parent
499ddadebd
commit
85deb958a0
15 changed files with 23 additions and 21 deletions
|
@ -159,7 +159,6 @@ export type TestSummary = t.TypeOf<typeof SummaryCodec>;
|
|||
|
||||
export const PingType = t.intersection([
|
||||
t.type({
|
||||
timestamp: t.string,
|
||||
monitor: MonitorType,
|
||||
docId: t.string,
|
||||
observer: ObserverCodec,
|
||||
|
|
|
@ -111,8 +111,8 @@ export const MonitorDetailsPanel = ({
|
|||
</EuiDescriptionListDescription>
|
||||
<EuiDescriptionListTitle>{LAST_RUN_LABEL}</EuiDescriptionListTitle>
|
||||
<EuiDescriptionListDescription>
|
||||
{latestPing?.timestamp ? (
|
||||
<Time timestamp={latestPing?.timestamp} />
|
||||
{latestPing?.['@timestamp'] ? (
|
||||
<Time timestamp={latestPing?.['@timestamp']} />
|
||||
) : (
|
||||
<EuiText color="subdued">
|
||||
{i18n.translate('xpack.synthetics.monitorDetailsPanel.TextLabel', {
|
||||
|
|
|
@ -20,7 +20,7 @@ export const ViewDocument = ({ ping }: { ping: Ping }) => {
|
|||
|
||||
const dataView = useSyntheticsDataView();
|
||||
const formatter = useDateFormat();
|
||||
const formattedTimestamp = formatter(ping.timestamp);
|
||||
const formattedTimestamp = formatter(ping['@timestamp']);
|
||||
|
||||
const [, hit] = useEsDocSearch({ id: ping.docId, index: SYNTHETICS_INDEX_PATTERN, dataView });
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ export const ErrorDuration: React.FC = () => {
|
|||
|
||||
const { killerState } = useFindMyKillerState();
|
||||
|
||||
const endsAt = killerState?.timestamp ? moment(killerState?.timestamp) : moment();
|
||||
const endsAt = killerState?.['@timestamp'] ? moment(killerState?.['@timestamp']) : moment();
|
||||
const startedAt = moment(state?.started_at);
|
||||
|
||||
const duration = state ? getErrorDuration(startedAt, endsAt) : 0;
|
||||
|
|
|
@ -26,7 +26,7 @@ export const ErrorTimeline = ({ lastTestRun }: { lastTestRun?: Ping }) => {
|
|||
from: moment(startedAt)
|
||||
.subtract(diff / 2, 'minutes')
|
||||
.toISOString(),
|
||||
to: moment(lastTestRun.timestamp)
|
||||
to: moment(lastTestRun['@timestamp'])
|
||||
.add(diff / 2, 'minutes')
|
||||
.toISOString(),
|
||||
}}
|
||||
|
|
|
@ -15,7 +15,7 @@ export const ResolvedAt: React.FC = () => {
|
|||
const { killerState } = useFindMyKillerState();
|
||||
|
||||
const formatter = useDateFormat();
|
||||
let endsAt: string | ReactElement = formatter(killerState?.timestamp ?? '');
|
||||
let endsAt: string | ReactElement = formatter(killerState?.['@timestamp'] ?? '');
|
||||
|
||||
if (!endsAt) {
|
||||
endsAt = 'N/A';
|
||||
|
|
|
@ -14,7 +14,7 @@ import { useMonitorLatestPing } from './hooks/use_monitor_latest_ping';
|
|||
export const MonitorDetailsLastRun: React.FC = () => {
|
||||
const { latestPing, loading: pingsLoading } = useMonitorLatestPing();
|
||||
let description: string | ReactElement = latestPing
|
||||
? moment(latestPing.timestamp).fromNow()
|
||||
? moment(latestPing['@timestamp']).fromNow()
|
||||
: '--';
|
||||
|
||||
if (!latestPing && pingsLoading) {
|
||||
|
@ -27,7 +27,10 @@ export const MonitorDetailsLastRun: React.FC = () => {
|
|||
{
|
||||
title: LAST_RUN_LABEL,
|
||||
description: (
|
||||
<EuiToolTip content={moment(latestPing?.timestamp).format('LLL')} position="bottom">
|
||||
<EuiToolTip
|
||||
content={moment(latestPing?.['@timestamp']).format('LLL')}
|
||||
position="bottom"
|
||||
>
|
||||
<>{description}</>
|
||||
</EuiToolTip>
|
||||
),
|
||||
|
|
|
@ -156,7 +156,7 @@ const PanelHeader = ({
|
|||
const { monitorId } = useParams<{ monitorId: string }>();
|
||||
|
||||
const formatter = useDateFormat();
|
||||
const lastRunTimestamp = formatter(latestPing?.timestamp);
|
||||
const lastRunTimestamp = formatter(latestPing?.['@timestamp']);
|
||||
|
||||
const isBrowserMonitor = monitor?.[ConfigKey.MONITOR_TYPE] === MonitorTypeEnum.BROWSER;
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ export const TestRunsTable = ({
|
|||
<JourneyLastScreenshot
|
||||
checkGroupId={item.monitor.check_group}
|
||||
size={THUMBNAIL_SCREENSHOT_SIZE_MOBILE}
|
||||
timestamp={item.timestamp}
|
||||
timestamp={item['@timestamp']}
|
||||
/>
|
||||
</EuiFlexGroup>
|
||||
),
|
||||
|
@ -332,7 +332,11 @@ export const MobileRowDetails = ({
|
|||
}) => {
|
||||
return (
|
||||
<EuiFlexGroup direction="column" gutterSize="m">
|
||||
<TestDetailsLink isBrowserMonitor={isBrowserMonitor} timestamp={ping.timestamp} ping={ping} />
|
||||
<TestDetailsLink
|
||||
isBrowserMonitor={isBrowserMonitor}
|
||||
timestamp={ping['@timestamp']}
|
||||
ping={ping}
|
||||
/>
|
||||
<EuiFlexGroup
|
||||
justifyContent="spaceBetween"
|
||||
alignItems="center"
|
||||
|
|
|
@ -37,7 +37,6 @@ describe('Monitor Detail Flyout', () => {
|
|||
jest.spyOn(monitorDetail, 'useMonitorDetail').mockReturnValue({
|
||||
data: {
|
||||
docId: 'docId',
|
||||
timestamp: '2013-03-01 12:54:23',
|
||||
monitor: {
|
||||
name: 'test monitor',
|
||||
id: 'test-id',
|
||||
|
|
|
@ -26,7 +26,7 @@ const getPingStatusLabel = (status: string) => {
|
|||
};
|
||||
|
||||
export const PingStatusColumn = ({ pingStatus, item }: Props) => {
|
||||
const timeStamp = moment(item.timestamp);
|
||||
const timeStamp = moment(item['@timestamp']);
|
||||
|
||||
let checkedTime = '';
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ export const useMonitorDetail = (
|
|||
|
||||
if (!result || result.hits.hits.length !== 1) return { data: undefined, loading };
|
||||
return {
|
||||
data: { ...result.hits.hits[0]._source, timestamp: result.hits.hits[0]._source['@timestamp'] },
|
||||
data: result.hits.hits[0]._source,
|
||||
loading,
|
||||
};
|
||||
};
|
||||
|
|
|
@ -65,7 +65,7 @@ export function* fetchSyntheticsMonitorEffect() {
|
|||
recentPingFromList?.[ConfigKey.CONFIG_ID] &&
|
||||
lastRunPing?.[ConfigKey.CONFIG_ID] === recentPingFromList?.[ConfigKey.CONFIG_ID] &&
|
||||
lastRunPing?.observer?.geo?.name === recentPingFromList?.observer?.geo?.name &&
|
||||
new Date(lastRunPing?.timestamp) < new Date(recentPingFromList?.timestamp)
|
||||
new Date(lastRunPing?.['@timestamp']) < new Date(recentPingFromList?.['@timestamp'])
|
||||
) {
|
||||
yield put(updateMonitorLastRunAction({ data: recentPingFromList }));
|
||||
}
|
||||
|
|
|
@ -345,7 +345,7 @@ function getMonitorDetailsMockSlice() {
|
|||
version: '8.3.0',
|
||||
},
|
||||
synthetics: {
|
||||
journey: { name: 'inline', id: 'inline', tags: null },
|
||||
journey: { name: 'inline', id: 'inline' },
|
||||
type: 'heartbeat/summary',
|
||||
},
|
||||
monitor: {
|
||||
|
@ -380,7 +380,6 @@ function getMonitorDetailsMockSlice() {
|
|||
ecs: { version: '8.0.0' },
|
||||
config_id: '4afd3980-0b72-11ed-9c10-b57918ea89d6',
|
||||
data_stream: { namespace: 'default', type: 'synthetics', dataset: 'browser' },
|
||||
timestamp: '2022-07-24T17:04:03.769Z',
|
||||
docId: 'mkYqMYIBqL6WCtughFUq',
|
||||
},
|
||||
{
|
||||
|
@ -436,7 +435,6 @@ function getMonitorDetailsMockSlice() {
|
|||
ecs: { version: '8.0.0' },
|
||||
config_id: '4afd3980-0b72-11ed-9c10-b57918ea89d6',
|
||||
data_stream: { namespace: 'default', type: 'synthetics', dataset: 'browser' },
|
||||
timestamp: '2022-07-24T17:01:48.326Z',
|
||||
docId: 'kUYoMYIBqL6WCtugc1We',
|
||||
},
|
||||
],
|
||||
|
|
|
@ -100,11 +100,10 @@ export const getLastSuccessfulCheck = async ({
|
|||
return null;
|
||||
}
|
||||
|
||||
const check = result.hits.hits[0]._source as Ping & { '@timestamp': string };
|
||||
const check = result.hits.hits[0]._source as Ping;
|
||||
|
||||
return {
|
||||
...check,
|
||||
timestamp: check['@timestamp'],
|
||||
docId: result.hits.hits[0]._id!,
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue