Skip to content

Commit

Permalink
chore: switch from counter to gauge
Browse files Browse the repository at this point in the history
  • Loading branch information
hoeppner-dataport committed Jul 4, 2024
1 parent 0307e61 commit 4019bad
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions apps/server/src/modules/board/metrics/metrics.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common';
import { UserDO } from '@shared/domain/domainobject';
import { RoleName } from '@shared/domain/interface';
import { UserService } from '@src/modules/user';
import { Counter, Gauge, Summary, register } from 'prom-client';
import { Gauge, Summary, register } from 'prom-client';

type ClientId = string;
type Role = 'owner' | 'editor' | 'viewer';
Expand All @@ -19,7 +19,7 @@ export class MetricsService {

private executionTimesSummary: Map<string, Summary<string>> = new Map();

private actionCounters: Map<string, Counter<string>> = new Map();
private actionCounters: Map<string, Gauge<string>> = new Map();

constructor(private readonly userService: UserService) {
this.numberOfBoardroomsOnServerCounter = new Gauge({
Expand Down Expand Up @@ -104,7 +104,7 @@ export class MetricsService {
let counter = this.actionCounters.get(actionName);

if (!counter) {
counter = new Counter({
counter = new Gauge({
name: `sc_boards_count_${actionName}`,
help: 'Number of calls for a specific action per minute',
// async collect() {
Expand All @@ -117,5 +117,6 @@ export class MetricsService {
register.registerMetric(counter);
}
counter.inc();
// console.log(actionName, counter);
}
}

0 comments on commit 4019bad

Please sign in to comment.