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

Add tags to journeys + filtering #60

Closed
wants to merge 6 commits into from
Closed

Conversation

andrewvc
Copy link
Contributor

@andrewvc andrewvc commented Sep 25, 2020

Fixes #26 adds tags as metadata to journeys that can be filtered on. These tags will be searchable / filterable in the Uptime UI

@apmmachine
Copy link

apmmachine commented Sep 25, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #60 event]

  • Start Time: 2020-10-01T22:49:36.332+0000

  • Duration: 16 min 25 sec

Test stats 🧪

Test Results
Failed 0
Passed 31
Skipped 1
Total 32

@andrewvc andrewvc marked this pull request as ready for review October 1, 2020 22:49
Copy link
Contributor

@hmdhk hmdhk left a comment

Choose a reason for hiding this comment

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

Thanks @andrewvc , I left a few comments.

As a side note, we probably should have a warning that the names/tags combination didn't match any journeys.

@@ -56,7 +56,8 @@ process.env.DEBUG = program.debug || '';
headless: program.headless,
screenshots: program.screenshots,
dryRun: program.dryRun,
journeyName: program.journeyName,
journeyNames: program.journeyNames,
journeyTags: program.journeyTags,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we consider renaming these to make it clear that these are for filtering? Or maybe the original proposal that had include-tags, exclude-tags

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, that's right we discussed this. I'm glad to rename it as you discussed. --includeTags and --includeJourneys which will accept the globs. I'll also include an exclude variant.

@@ -3,7 +3,7 @@ import { grey, cyan, dim, italic } from 'kleur/colors';
import { now } from '../helpers';

const defaultFd = process.stdout.fd;
let logger = new SonicBoom({ fd: defaultFd });
let logger = new SonicBoom({ fd: defaultFd, sync: true });
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the sync option necessary here? adding a comment in the code would be useful

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, good catch, it's not I need to remove this. I was trying to see if that would fix #69 , but it did not. I'll revert this change.

}

tagsMatch(globs: string[]): boolean {
return globs.some(glob => match(this.options.tags, glob).length > 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: might be better to refactor this into a function like:

const isMatch = (list, globs) => globs.some(glob => match(list,glob).length>0)

src/dsl/journey.ts Show resolved Hide resolved

for (const j of matchingJourneys) {
const journeyResult = await this.runJourney(j, options);
result[j.options.name] = journeyResult;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I would match the journey in this for, instead of having a separate filter.
Something like

if(j.matches(...)){
// run journey
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, I initially did that, but thought it was cleaner to hoist it out, It's not a big deal, glad to move it back

'only run the journey with the given name(s), or glob matches'
)
.option(
'--journey-tags <name>...',
Copy link
Member

@vigneshshanmugam vigneshshanmugam Oct 12, 2020

Choose a reason for hiding this comment

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

nit: <tags>

@@ -26,7 +26,8 @@ export async function run(options: RunOptions) {
headless: options.headless ?? cliArgs.headless,
screenshots: options.screenshots ?? cliArgs.screenshots,
dryRun: options.dryRun ?? cliArgs.dryRun,
journeyName: options.journeyName ?? cliArgs.journeyName,
journeyNames: options.journeyNames ?? cliArgs.journeyName,
Copy link
Member

Choose a reason for hiding this comment

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

As our runner is supposed to be running only journeys for now. should we just keep it simple and call name and tags instead? It feels redundant

@vigneshshanmugam
Copy link
Member

Closing in favor of #300

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.

Add tags, filtering
5 participants