-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Unify logic for metrics collection when any command is invoked #5
Unify logic for metrics collection when any command is invoked #5
Conversation
@smoya Metrics are sent but the format of the action invoked is detected as Also I need to remove the code corresponding to this metric in all the other commands. |
@smoya
|
src/base.ts
Outdated
@@ -29,6 +31,28 @@ export default abstract class extends Command { | |||
const {document} = await this.parser.parse(rawDocument); | |||
if (document !== undefined) { | |||
metadata = MetadataFromDocument(document, metadata); | |||
const commandName : string = this.id || ''; | |||
switch (commandName) { | |||
case 'validate': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused about the reason you moved all the logic from each command to this big switch statement here.
As I see, this is going into a bit of a deep hole. Do you think we could roll back this (last changes) and just merge the PR so we can move forward and start collecting metrics? Then we could work on this later.
The extended side of this comment for future work:
We have what we would like to have ideally, a way of tracking, from the base.ts
, that the command was executed and includes some metadata, if exists.
But I would say nothing about moving all the metadata collection logic to the base.ts
file. This should stay in each command as it is the responsibility of each command to collect such metadata.
Instead of doing this, have you thought about the possibility of setting all this metadata into a property declared in the base.ts
file but set on each command? I mean, something like this.metadata['success'] = true;
but from the command. Then, base.ts
could grab that metadata.
@smoya Last changes already rolled back so we can merge this PR and start collecting metrics. |
No, it is an general issue in the CLI repository. https://asyncapi.slack.com/archives/CQVJXFNQL/p1702289410144129 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀🌔
Add new methods to unify logic so metrics are collected when any CLI command is invoked. All this logic will be implemented in
base.ts
file and removed from the different command files.