Skip to content

Commit

Permalink
[Synthetics] prevent decryption errors from causing the entire suite …
Browse files Browse the repository at this point in the history
…of monitors to fail syncing (elastic#140549)

* synthetics - prevent decryption errors from causing the entire suite of monitors to fail syncing

* adjust decryption error catching logic

* Update x-pack/plugins/synthetics/server/synthetics_service/synthetics_service.ts

* Update x-pack/plugins/synthetics/server/synthetics_service/synthetics_service.ts

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit d9b7c3f)
  • Loading branch information
dominiqueclarke committed Sep 13, 2022
1 parent 3167106 commit 512e6b5
Showing 1 changed file with 28 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -434,17 +434,36 @@ export class SyntheticsService {

const start = performance.now();

const monitors: Array<SavedObject<SyntheticsMonitorWithSecrets>> = await Promise.all(
encryptedMonitors.map((monitor) =>
encryptedClient.getDecryptedAsInternalUser<SyntheticsMonitorWithSecrets>(
syntheticsMonitor.name,
monitor.id,
{
namespace: monitor.namespaces?.[0],
}
const monitors: Array<SavedObject<SyntheticsMonitorWithSecrets>> = (
await Promise.all(
encryptedMonitors.map(
(monitor) =>
new Promise((resolve) => {
encryptedClient
.getDecryptedAsInternalUser<SyntheticsMonitorWithSecrets>(
syntheticsMonitor.name,
monitor.id,
{
namespace: monitor.namespaces?.[0],
}
)
.then((decryptedMonitor) => resolve(decryptedMonitor))
.catch((e) => {
this.logger.error(e);
sendErrorTelemetryEvents(this.logger, this.server.telemetry, {
reason: 'Failed to decrypt monitor',
message: e?.message,
type: 'runTaskError',
code: e?.code,
status: e.status,
kibanaVersion: this.server.kibanaVersion,
});
resolve(null);
});
})
)
)
);
).filter((monitor) => monitor !== null) as Array<SavedObject<SyntheticsMonitorWithSecrets>>;

const end = performance.now();
const duration = end - start;
Expand Down

0 comments on commit 512e6b5

Please sign in to comment.