Skip to content

688 prometheus integration - #827

Open
geourjoa wants to merge 16 commits into
mainfrom
688-prometheus-integration
Open

688 prometheus integration#827
geourjoa wants to merge 16 commits into
mainfrom
688-prometheus-integration

Conversation

@geourjoa

@geourjoa geourjoa commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread backend/src/main.ts
const app = await NestFactory.create(AppModule);

const metrics = app.get(MetricsService);
app.useGlobalInterceptors(new HttpMetricsInterceptor(metrics));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interceptor seem to be registered twice, also on app.module.ts L106

Comment thread backend/src/app.module.ts
provide: Logger,
useClass: CustomLogger,
},
{ provide: APP_INTERCEPTOR, useClass: HttpMetricsInterceptor },

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already registered in main.ts L22 ?

Comment thread monitoring/prometheus.yml
scheme: http
metrics_path: /metrics
static_configs:
- targets: [ 'mmu-backend-test.larus.tetras-libre.fr' ]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded endpoint

registers: [this.registry],
collect: async () => {
try {
const { stdout } = await execFileAsync('du', ['-sb', '/upload'], {

@geourjoa geourjoa Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must use upload folder path defined in L30 ?

service = module.get<MetricsService>(MetricsService);
});

it('should be defined', () => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No tests implemented.

At least return a 200 and body with Prometheus formatted data ?

}

const project = await this.findOne(projectId);
const startedAt = project?.lockedAt;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a potential issue here.
If no lockedAt value we record anything ?

Can you explain what's your intention here ?

@@ -124,10 +132,30 @@ export class ProjectService {

async lockProject(projectId: number, lock: boolean, userId: number) {

@geourjoa geourjoa Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you check if the user unlocking is the same than lock before ?

If I remember rightly we have sometime an unwanted lock message that happen in UI (i have no scenario to reproduct, but sometime I open for the first time an existing project and i get it).

Can you check or implement unit test on this function ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add business metrics (projects, logins, route usage) to Prometheus/Grafana monitoring

2 participants