Skip to content

Commit 03bd9b8

Browse files
committed
fix: trying to fix loki
1 parent 64ffa67 commit 03bd9b8

File tree

5 files changed

+43
-80
lines changed

5 files changed

+43
-80
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ yarn-error.log*
4444
.vscode/
4545
/pgdata
4646
/redis-data
47+
/loki-data

apps/api-gateway/src/logging/loki-logger.service.ts

Lines changed: 0 additions & 43 deletions
This file was deleted.

apps/api-gateway/src/logging/loki-logging.interceptor.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

apps/api-gateway/src/main.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import cookieParser from 'cookie-parser';
66
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
77
import { ConfigService } from '@nestjs/config';
88
import { Configuration } from '@leetcode/config';
9-
import { LokiLogger } from './logging/loki-logger.service';
10-
import { LokiLoggingInterceptor } from './logging/loki-logging.interceptor';
119

1210
declare global {
1311
namespace Express {
@@ -19,7 +17,6 @@ declare global {
1917

2018
async function bootstrap() {
2119
const app = await NestFactory.create(AppModule);
22-
const logger = new LokiLogger();
2320

2421
// CONFIGURATION
2522
const configService = app.get(ConfigService<Configuration>);
@@ -29,9 +26,6 @@ async function bootstrap() {
2926
// VALIDATION
3027
app.useGlobalPipes(new ValidationPipe({ exceptionFactory }));
3128

32-
// LOGGING
33-
app.useGlobalInterceptors(new LokiLoggingInterceptor(logger));
34-
3529
// MIDDLWARE
3630
app.use(cookieParser());
3731
app.enableCors({

docker-compose.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ services:
5050
container_name: leetcode-api-gateway
5151
ports:
5252
- '5000:5000'
53+
logging:
54+
driver: loki
55+
options:
56+
loki-url: "http://loki:3100/loki/api/v1/push"
57+
labels: "api-gateway"
5358
environment:
5459
- NODE_ENV=production
5560
- API_GATEWAY_PORT=5000
@@ -85,6 +90,11 @@ services:
8590
container_name: leetcode-users-service
8691
ports:
8792
- '5001:5001'
93+
logging:
94+
driver: loki
95+
options:
96+
loki-url: "http://loki:3100/loki/api/v1/push"
97+
labels: "users-service"
8898
environment:
8999
- NODE_ENV=production
90100
- API_GATEWAY_PORT=5000
@@ -120,6 +130,11 @@ services:
120130
container_name: leetcode-auth-service
121131
ports:
122132
- '5002:5002'
133+
logging:
134+
driver: loki
135+
options:
136+
loki-url: "http://loki:3100/loki/api/v1/push"
137+
labels: "auth-service"
123138
environment:
124139
- NODE_ENV=production
125140
- API_GATEWAY_PORT=5000
@@ -155,6 +170,11 @@ services:
155170
container_name: leetcode-problems-service
156171
ports:
157172
- '5003:5003'
173+
logging:
174+
driver: loki
175+
options:
176+
loki-url: "http://loki:3100/loki/api/v1/push"
177+
labels: "problems-service"
158178
environment:
159179
- NODE_ENV=production
160180
- API_GATEWAY_PORT=5000
@@ -188,6 +208,11 @@ services:
188208
container_name: leetcode-tags-service
189209
ports:
190210
- '5004:5004'
211+
logging:
212+
driver: loki
213+
options:
214+
loki-url: "http://loki:3100/loki/api/v1/push"
215+
labels: "tags-service"
191216
environment:
192217
- NODE_ENV=production
193218
- API_GATEWAY_PORT=5000
@@ -221,6 +246,11 @@ services:
221246
container_name: leetcode-companies-service
222247
ports:
223248
- '5005:5005'
249+
logging:
250+
driver: loki
251+
options:
252+
loki-url: "http://loki:3100/loki/api/v1/push"
253+
labels: "companies-service"
224254
environment:
225255
- NODE_ENV=production
226256
- API_GATEWAY_PORT=5000
@@ -254,6 +284,11 @@ services:
254284
container_name: leetcode-submissions-service
255285
ports:
256286
- '5006:5006'
287+
logging:
288+
driver: loki
289+
options:
290+
loki-url: "http://loki:3100/loki/api/v1/push"
291+
labels: "submissions-service"
257292
environment:
258293
- NODE_ENV=production
259294
- API_GATEWAY_PORT=5000
@@ -289,6 +324,11 @@ services:
289324
container_name: leetcode-execution-service
290325
ports:
291326
- '5007:5007'
327+
logging:
328+
driver: loki
329+
options:
330+
loki-url: "http://loki:3100/loki/api/v1/push"
331+
labels: "execution-service"
292332
environment:
293333
- NODE_ENV=production
294334
- API_GATEWAY_PORT=5000
@@ -354,6 +394,8 @@ services:
354394
ports:
355395
- "3100:3100"
356396
restart: unless-stopped
397+
volumes:
398+
- ./loki-data:/loki
357399

358400
volumes:
359401
pgdata:

0 commit comments

Comments
 (0)