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 perf test #312

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"type": "module",
"dependencies": {
"@apollo/gateway": "^2.7.1",
"@apollo/gateway": "^2.7.8",
"clipanion": "^3.2.0-rc.13",
"graphql": "^16.8.1",
"graphql-request": "^4.3.0",
Expand All @@ -25,6 +25,7 @@
"gql": "yarn graphql-codegen && yarn tsc -p studio/tsconfig.json",
"dev": "node bin/index.js",
"dev:example": "yarn dev --supergraph example/supergraph.graphql --operation example/operation.graphql",
"dev:example:pretty": "yarn dev:example --pretty"
"dev:example:pretty": "yarn dev:example --pretty",
"dev:example:perf": "yarn dev --supergraph example/supergraph.graphql --operation example/operation.graphql --skipLog"
}
}
11 changes: 10 additions & 1 deletion src/commands/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export class DefaultCommand extends Command {

sudo = Option.Boolean("--sudo");

skipLog = Option.Boolean("--skipLog");

async execute() {
if (this.supergraph && this.graphref) {
this.context.stderr.write(
Expand All @@ -43,6 +45,10 @@ export class DefaultCommand extends Command {

const queryPlan = await generateQueryPlan(result, operation);

if (this.skipLog) {
return;
}

if (this.pretty) {
this.context.stdout.write(prettyFormatQueryPlan(queryPlan));
} else {
Expand All @@ -63,7 +69,10 @@ export async function generateQueryPlan(supergraph, operationDoc, operationName)
operationName,
});
const queryPlanner = new QueryPlanner(supergraph);
return queryPlanner.buildQueryPlan(operation);
console.time('Query Plan');
const plan = queryPlanner.buildQueryPlan(operation);
console.timeEnd('Query Plan');
return plan;
}

/**
Expand Down
Loading
Loading