Skip to content

Commit

Permalink
Remove recursive plugin status in meta field (#106286) (#106390)
Browse files Browse the repository at this point in the history
Co-authored-by: Josh Dover <1813008+joshdover@users.noreply.github.com>
  • Loading branch information
kibanamachine and joshdover committed Jul 21, 2021
1 parent e898416 commit 90f4764
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 60 deletions.
43 changes: 3 additions & 40 deletions src/core/server/status/get_summary_status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,7 @@ describe('getSummaryStatus', () => {
summary: '[s2]: Lorem ipsum',
detail: 'See the status page for more information',
meta: {
affectedServices: {
s2: {
level: ServiceStatusLevels.unavailable,
summary: 'Lorem ipsum',
meta: {
custom: { data: 'here' },
},
},
},
affectedServices: ['s2'],
},
});
});
Expand All @@ -136,17 +128,7 @@ describe('getSummaryStatus', () => {
detail: 'Vivamus pulvinar sem ac luctus ultrices.',
documentationUrl: 'http://helpmenow.com/problem1',
meta: {
affectedServices: {
s2: {
level: ServiceStatusLevels.unavailable,
summary: 'Lorem ipsum',
detail: 'Vivamus pulvinar sem ac luctus ultrices.',
documentationUrl: 'http://helpmenow.com/problem1',
meta: {
custom: { data: 'here' },
},
},
},
affectedServices: ['s2'],
},
});
});
Expand Down Expand Up @@ -183,26 +165,7 @@ describe('getSummaryStatus', () => {
summary: '[2] services are unavailable',
detail: 'See the status page for more information',
meta: {
affectedServices: {
s2: {
level: ServiceStatusLevels.unavailable,
summary: 'Lorem ipsum',
detail: 'Vivamus pulvinar sem ac luctus ultrices.',
documentationUrl: 'http://helpmenow.com/problem1',
meta: {
custom: { data: 'here' },
},
},
s3: {
level: ServiceStatusLevels.unavailable,
summary: 'Proin mattis',
detail: 'Nunc quis nulla at mi lobortis pretium.',
documentationUrl: 'http://helpmenow.com/problem2',
meta: {
other: { data: 'over there' },
},
},
},
affectedServices: ['s2', 's3'],
},
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/status/get_summary_status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const getSummaryStatus = (
// TODO: include URL to status page
detail: status.detail ?? `See the status page for more information`,
meta: {
affectedServices: { [serviceName]: status },
affectedServices: [serviceName],
},
};
} else {
Expand All @@ -41,7 +41,7 @@ export const getSummaryStatus = (
// TODO: include URL to status page
detail: `See the status page for more information`,
meta: {
affectedServices: Object.fromEntries(highestStatuses),
affectedServices: highestStatuses.map(([serviceName]) => serviceName),
},
};
}
Expand Down
7 changes: 1 addition & 6 deletions src/core/server/status/plugins_status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,7 @@ describe('PluginStatusService', () => {
summary: '[a]: Status check timed out after 30s',
detail: 'See the status page for more information',
meta: {
affectedServices: {
a: {
level: ServiceStatusLevels.unavailable,
summary: 'Status check timed out after 30s',
},
},
affectedServices: ['a'],
},
},
});
Expand Down
18 changes: 6 additions & 12 deletions src/core/server/status/status_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,9 @@ describe('StatusService', () => {
"detail": "See the status page for more information",
"level": degraded,
"meta": Object {
"affectedServices": Object {
"savedObjects": Object {
"level": degraded,
"summary": "This is degraded!",
},
},
"affectedServices": Array [
"savedObjects",
],
},
"summary": "[savedObjects]: This is degraded!",
},
Expand Down Expand Up @@ -305,12 +302,9 @@ describe('StatusService', () => {
"detail": "See the status page for more information",
"level": degraded,
"meta": Object {
"affectedServices": Object {
"savedObjects": Object {
"level": degraded,
"summary": "This is degraded!",
},
},
"affectedServices": Array [
"savedObjects",
],
},
"summary": "[savedObjects]: This is degraded!",
},
Expand Down