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

feat: abort push on duplicate monitors #568

Merged
merged 2 commits into from
Aug 2, 2022

Conversation

vigneshshanmugam
Copy link
Member

  • fix Duplicate journey id, silently groups synthetic pings under the last journey in list #442
  • Aborts the push command if any of the monitors contain duplicate ids with a clean error message and also linking users to the duplicate monitor files where required.
  • Decided to handle the logic here as Kibana currently does not have any way to know if there are any duplicates without looking up the saved objects which is not performant when we have all the list already available via the agent.

Screen Shot 2022-08-01 at 3 30 41 PM

Testing.

  • Build the local project using - npm run build
  1. Setup a brand new Synthetics project - node dist/cli.js init [optional-dir]
  2. Change the monitior ids for some of the monitors.
  3. Run push command - node dist/cli.js push --auth <>

@apmmachine
Copy link

apmmachine commented Aug 1, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-08-02T17:48:37.685+0000

  • Duration: 14 min 52 sec

Test stats 🧪

Test Results
Failed 0
Passed 172
Skipped 2
Total 174

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.


import { journey, monitor } from '../../src';

journey('journey 1', () => monitor.use({ id: 'duplicate' }));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since names are used as ids in the absense of id, can we add two monitors with the same name to this fixture as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good callout, sure will do.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done - 4b3837a

@dominiqueclarke dominiqueclarke self-requested a review August 2, 2022 16:58
Copy link
Contributor

@dominiqueclarke dominiqueclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tested four scenarios

  1. Two monitors with the same id configured via monitor.use
  2. Two monitors with the same id configure via journey options
  3. Two monitors with the same name without id configured via the other two options
  4. Two monitors, one with an id specified, one without an id specified, where the name of the former and the id of the latter are the same.

@vigneshshanmugam vigneshshanmugam merged commit e55970d into elastic:main Aug 2, 2022
@vigneshshanmugam vigneshshanmugam deleted the track-duplicateds branch August 2, 2022 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate journey id, silently groups synthetic pings under the last journey in list
3 participants