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
  • Loading branch information
dominiqueclarke committed Sep 12, 2022
1 parent 0e9845f commit 42f0566
Showing 1 changed file with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -434,17 +434,32 @@ 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) => {
try {
return encryptedClient.getDecryptedAsInternalUser<SyntheticsMonitorWithSecrets>(
syntheticsMonitor.name,
monitor.id,
{
namespace: monitor.namespaces?.[0],
}
);
} 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,
});
return null;
}
)
})
)
);
).filter((monitor) => monitor !== null) as Array<SavedObject<SyntheticsMonitorWithSecrets>>;

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

0 comments on commit 42f0566

Please sign in to comment.