mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
# Backport This will backport the following commits from `main` to `8.6`: - [[Enterprise Search] Fix logic for long running and orphaned jobs (#145714)](https://github.com/elastic/kibana/pull/145714) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Sander Philipse","email":"94373878+sphilipse@users.noreply.github.com"},"sourceCommit":{"committedDate":"2022-11-22T13:27:46Z","message":"[Enterprise Search] Fix logic for long running and orphaned jobs (#145714)\n\nThis fixes the logic for long-running connector sync jobs: they should\r\nlook at started_at rather than last_seen.\r\nIt also fixes the logic for orphaned jobs, which were displaying the\r\nopposite of what they should have been displaying.","sha":"2e178f8f450ad6019903af17881c8368806816c8","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:EnterpriseSearch","v8.6.0","v8.7.0"],"number":145714,"url":"https://github.com/elastic/kibana/pull/145714","mergeCommit":{"message":"[Enterprise Search] Fix logic for long running and orphaned jobs (#145714)\n\nThis fixes the logic for long-running connector sync jobs: they should\r\nlook at started_at rather than last_seen.\r\nIt also fixes the logic for orphaned jobs, which were displaying the\r\nopposite of what they should have been displaying.","sha":"2e178f8f450ad6019903af17881c8368806816c8"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/145714","number":145714,"mergeCommit":{"message":"[Enterprise Search] Fix logic for long running and orphaned jobs (#145714)\n\nThis fixes the logic for long-running connector sync jobs: they should\r\nlook at started_at rather than last_seen.\r\nIt also fixes the logic for orphaned jobs, which were displaying the\r\nopposite of what they should have been displaying.","sha":"2e178f8f450ad6019903af17881c8368806816c8"}}]}] BACKPORT-->
This commit is contained in:
parent
ba7a37ef34
commit
218162f282
1 changed files with 12 additions and 6 deletions
|
@ -24,8 +24,14 @@ export const fetchSyncJobsStats = async (client: IScopedClusterClient): Promise<
|
|||
const orphanedJobsCountResponse = await client.asCurrentUser.count({
|
||||
index: CONNECTORS_JOBS_INDEX,
|
||||
query: {
|
||||
terms: {
|
||||
'connector.id': ids,
|
||||
bool: {
|
||||
must_not: [
|
||||
{
|
||||
terms: {
|
||||
'connector.id': ids,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -51,7 +57,7 @@ export const fetchSyncJobsStats = async (client: IScopedClusterClient): Promise<
|
|||
},
|
||||
{
|
||||
range: {
|
||||
last_seen: {
|
||||
started_at: {
|
||||
lt: moment().subtract(1, 'day').toISOString(),
|
||||
},
|
||||
},
|
||||
|
@ -62,10 +68,10 @@ export const fetchSyncJobsStats = async (client: IScopedClusterClient): Promise<
|
|||
});
|
||||
|
||||
const errorResponse = await client.asCurrentUser.count({
|
||||
index: CONNECTORS_JOBS_INDEX,
|
||||
index: CONNECTORS_INDEX,
|
||||
query: {
|
||||
term: {
|
||||
status: SyncStatus.ERROR,
|
||||
last_sync_status: SyncStatus.ERROR,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -109,7 +115,7 @@ export const fetchSyncJobsStats = async (client: IScopedClusterClient): Promise<
|
|||
{
|
||||
range: {
|
||||
last_seen: {
|
||||
gt: moment().subtract(30, 'minutes').toISOString(),
|
||||
lt: moment().subtract(30, 'minutes').toISOString(),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue