Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Synthetics] prevent decryption errors from causing the entire suite of monitors to fail syncing #140549

Conversation

dominiqueclarke
Copy link
Contributor

@dominiqueclarke dominiqueclarke commented Sep 12, 2022

Summary

Ensures that decryption errors are caught, so that a single monitor that is unable to be decrypted does not prevent the whole monitor suite from being synced.

Testing

  1. Create at least two monitors
  2. Deliberately introduce an unhandled exception during decryption. For example, you can add the following to the getDecryptedAsInternalUser
    return {
      getDecryptedAsInternalUser: async <T = unknown>(
        type: string,
        id: string,
        options?: SavedObjectsBaseOptions
      ): Promise<SavedObject<T>> => {
        areferenceerror; // force an error
        const [internalRepository, typeRegistry] = await internalRepositoryAndTypeRegistryPromise;
        const savedObject = await internalRepository.get(type, id, options);

        if (!service.isRegistered(savedObject.type)) {
          return savedObject as SavedObject<T>;
        }

        return {
          ...savedObject,
          attributes: (await service.decryptAttributes(
            {
              type,
              id,
              namespace: getDescriptorNamespace(typeRegistry, type, options?.namespace),
            },
            savedObject.attributes as Record<string, unknown>
          )) as T,
        };
      },
  1. Ensure the monitor without error still runs as expected.

@dominiqueclarke dominiqueclarke added bug Fixes for quality problems that affect the customer experience release_note:fix Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v8.4.2 v8.5.0 labels Sep 13, 2022
@dominiqueclarke dominiqueclarke marked this pull request as ready for review September 13, 2022 02:46
@dominiqueclarke dominiqueclarke requested a review from a team as a code owner September 13, 2022 02:46
@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

@dominiqueclarke
Copy link
Contributor Author

@elasticmachine merge upstream

…-errors-from-causing-all-monitors-to-not-run
@dominiqueclarke dominiqueclarke changed the title synthetics - prevent decryption errors from causing the entire suite of monitors to fail syncing [Synthetics] prevent decryption errors from causing the entire suite of monitors to fail syncing Sep 13, 2022
…m-causing-all-monitors-to-not-run' of https://github.com/dominiqueclarke/kibana into fix/synthetics-prevent-individual-decryption-errors-from-causing-all-monitors-to-not-run
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@dominiqueclarke dominiqueclarke merged commit d9b7c3f into elastic:main Sep 13, 2022
@dominiqueclarke dominiqueclarke deleted the fix/synthetics-prevent-individual-decryption-errors-from-causing-all-monitors-to-not-run branch September 13, 2022 17:25
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 13, 2022
…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)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.4

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Sep 13, 2022
…of monitors to fail syncing (#140549) (#140644)

* 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)

Co-authored-by: Dominique Clarke <dominique.clarke@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience release_note:fix Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v8.4.2 v8.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants