first commit
This commit is contained in:
14
apps/api/src/app/metrics/metrics.service.ts
Normal file
14
apps/api/src/app/metrics/metrics.service.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class MetricsService {
|
||||
private readonly counters = new Map<string, number>();
|
||||
|
||||
increment(name: string, by = 1): void {
|
||||
this.counters.set(name, (this.counters.get(name) ?? 0) + by);
|
||||
}
|
||||
|
||||
snapshot(): Record<string, number> {
|
||||
return Object.fromEntries(this.counters.entries());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user