Skip to content

Commit

Permalink
docs: fix README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
smoya authored Aug 3, 2024
1 parent e83c35e commit 2bb3bef
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ Used to create an object containing all the properties needed to identify the me
Contains all the functions needed to record the different metrics we collect, like:
- `asyncapi_adoption.action.invoked`:
With this metric we are tracking any action started (but not finished) in a tool. For example, a command that got executed on the [CLI](https://github.com/asyncapi/cli/) but didn't finish yet. We just want to know which commands are used, regardless they have failed or succeeded.
```ts
async recordActionInvoked(actionName: string, metadata: MetricMetadata = {}) {
```ts
async recordActionInvoked(actionName: string, metadata: MetricMetadata = {}) {
metadata['action'] = actionName;
this.record(new Metric('action.invoked', MetricType.Counter, 1, metadata));
}
```
```
Example where this function is used:
```ts
async init(): Promise<void> {
async init(): Promise<void> {
await super.init();
const commandName : string = this.id || '';
await this.recordActionInvoked(commandName, this.metricsMetadata);
Expand All @@ -42,15 +42,15 @@ Example where this function is used:

- `asyncapi_adoption.action.finished`:
With this metric we are tracking the action executed once it has already finished, carrying the result of the execution and some metadata.
```ts
async recordActionFinished(actionName: string, metadata: MetricMetadata = {}) {
```ts
async recordActionFinished(actionName: string, metadata: MetricMetadata = {}) {
metadata['action'] = actionName;
this.record(new Metric('action.finished', MetricType.Counter, 1, metadata));
}
```
```
Example where this function is used:
```ts
async finally(error: Error | undefined): Promise<any> {
async finally(error: Error | undefined): Promise<any> {
await super.finally(error);
this.metricsMetadata['success'] = error === undefined;
await this.recordActionFinished(this.id as string, this.metricsMetadata, this.specFile?.text());
Expand Down

0 comments on commit 2bb3bef

Please sign in to comment.