Skip to content

Commit

Permalink
Add new metric recording for another command
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-rr committed Nov 22, 2023
1 parent b0b445e commit 0450a82
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@oclif/core": "^1.26.2",
"@oclif/errors": "^1.3.6",
"@oclif/plugin-not-found": "^2.3.22",
"@smoya/asyncapi-adoption-metrics": "^1.1.1",
"@smoya/asyncapi-adoption-metrics": "^2.0.0",
"@smoya/multi-parser": "^4.0.0",
"@stoplight/spectral-cli": "6.9.0",
"ajv": "^8.12.0",
Expand Down
10 changes: 10 additions & 0 deletions src/commands/generate/fromTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ export default class Template extends Command {
parser = new Parser();

async run() {
try {
// Metrics recording when command is invoked
await this.recorder.recordActionInvoked('fromTemplate');
await this.recorder.flush();
} catch (e: any) {
if (e instanceof Error) {
this.log(`Skipping submitting anonymous metrics due to the following error: ${e.name}: ${e.message}`);
}
}

const { args, flags } = await this.parse(Template); // NOSONAR

const asyncapi = args['asyncapi'];
Expand Down

0 comments on commit 0450a82

Please sign in to comment.