Skip to content

Commit 7135790

Browse files
committed
fix: add prometheus for every service
1 parent 1a36e02 commit 7135790

File tree

8 files changed

+26
-2
lines changed

8 files changed

+26
-2
lines changed

apps/auth-service/src/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { MailModule } from './mail/mail.module';
44
import { ConfigModule } from '@nestjs/config';
55
import { configuration, validate } from '@leetcode/config';
66
import { DatabaseModule } from '@leetcode/database';
7+
import { PrometheusModule } from '@willsoto/nestjs-prometheus';
78

89
@Module({
910
imports: [
@@ -17,6 +18,7 @@ import { DatabaseModule } from '@leetcode/database';
1718
DatabaseModule,
1819
AuthModule,
1920
MailModule,
21+
PrometheusModule.register(),
2022
],
2123
controllers: [],
2224
providers: [],

apps/companies-service/src/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { DatabaseModule } from '@leetcode/database';
33
import { Module } from '@nestjs/common';
44
import { ConfigModule } from '@nestjs/config';
55
import { CompaniesController } from './companies/companies.controller';
6+
import { PrometheusModule } from '@willsoto/nestjs-prometheus';
67

78
@Module({
89
imports: [
@@ -14,6 +15,7 @@ import { CompaniesController } from './companies/companies.controller';
1415
validate,
1516
}),
1617
DatabaseModule,
18+
PrometheusModule.register(),
1719
],
1820
controllers: [CompaniesController],
1921
providers: [],

apps/execution-service/src/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Configuration, configuration, validate } from '@leetcode/config';
55
import { DatabaseModule } from '@leetcode/database';
66
import { ExecutionConsumer } from './execution/execution.worker';
77
import { BullModule } from '@nestjs/bullmq';
8+
import { PrometheusModule } from '@willsoto/nestjs-prometheus';
89

910
@Module({
1011
imports: [
@@ -32,6 +33,7 @@ import { BullModule } from '@nestjs/bullmq';
3233
BullModule.registerQueue({
3334
name: 'results-queue',
3435
}),
36+
PrometheusModule.register(),
3537
],
3638
controllers: [],
3739
providers: [ExecutionService, ExecutionConsumer],

apps/problems-service/src/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { DatabaseModule } from '@leetcode/database';
44
import { ConfigModule } from '@nestjs/config';
55
import { configuration, validate } from '@leetcode/config';
66
import { ProblemsService } from './problems/problems.service';
7+
import { PrometheusModule } from '@willsoto/nestjs-prometheus';
78

89
@Module({
910
imports: [
@@ -15,6 +16,7 @@ import { ProblemsService } from './problems/problems.service';
1516
validate,
1617
}),
1718
DatabaseModule,
19+
PrometheusModule.register(),
1820
],
1921
controllers: [ProblemsController],
2022
providers: [ProblemsService],

apps/submissions-service/src/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ConfigModule, ConfigService } from '@nestjs/config';
55
import { Configuration, configuration, validate } from '@leetcode/config';
66
import { BullModule } from '@nestjs/bullmq';
77
import { ResultsConsumer } from './submissions/submissions.worker';
8+
import { PrometheusModule } from '@willsoto/nestjs-prometheus';
89

910
@Module({
1011
imports: [
@@ -32,6 +33,7 @@ import { ResultsConsumer } from './submissions/submissions.worker';
3233
BullModule.registerQueue({
3334
name: 'notifications-queue',
3435
}),
36+
PrometheusModule.register(),
3537
],
3638
controllers: [SubmissionsController],
3739
providers: [ResultsConsumer],

apps/tags-service/src/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { DatabaseModule } from '@leetcode/database';
33
import { Module } from '@nestjs/common';
44
import { ConfigModule } from '@nestjs/config';
55
import { TagsController } from './tags/tags.controller';
6+
import { PrometheusModule } from '@willsoto/nestjs-prometheus';
67

78
@Module({
89
imports: [
@@ -14,6 +15,7 @@ import { TagsController } from './tags/tags.controller';
1415
validate,
1516
}),
1617
DatabaseModule,
18+
PrometheusModule.register(),
1719
],
1820
controllers: [TagsController],
1921
providers: [],

apps/users-service/src/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { UsersController } from './users/users.controller';
33
import { DatabaseModule } from '@leetcode/database';
44
import { ConfigModule } from '@nestjs/config';
55
import { configuration, validate } from '@leetcode/config';
6+
import { PrometheusModule } from '@willsoto/nestjs-prometheus';
67

78
@Module({
89
imports: [
@@ -14,6 +15,7 @@ import { configuration, validate } from '@leetcode/config';
1415
validate,
1516
}),
1617
DatabaseModule,
18+
PrometheusModule.register(),
1719
],
1820
controllers: [UsersController],
1921
providers: [],

prometheus.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@ global:
22
scrape_interval: 4s
33

44
scrape_configs:
5-
- job_name: 'api-gateway'
5+
- job_name: 'prometheus'
66
static_configs:
7-
- targets: ['api-gateway:5000']
7+
- targets:
8+
[
9+
'api-gateway:5000',
10+
'users-service:5001',
11+
'auth-service:5002',
12+
'problems-service:5003',
13+
'tags-service:5004',
14+
'companies-service:5005',
15+
'submissions-service:5006',
16+
'execution-service:5007',
17+
]

0 commit comments

Comments
 (0)