Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] feat#331 부하테스트 위한 커스텀 메트릭 측정 기능 구현 #332

Merged
merged 4 commits into from
Dec 23, 2024

Conversation

NewCodes7
Copy link
Collaborator

@NewCodes7 NewCodes7 commented Dec 22, 2024

➕ 이슈 번호


🔎 작업 내용

  • /api/metric/start로 post 요청 보내면 메트릭 측정 시작

  • /api/metric/stop으로 post 요청 보내면 메트릭 측정 멈추고, 결과 반환

  • 메트릭 측정하고자 하는 지표 (아래 테스트한 예시)

    ksnghyk@KSNGHYK-book  ~  http post http://localhost:3000/api/metric/stop
    {
        "application": {
            "request": {
                "eventStats": {
                    "chatMessage": {
                        "count": 100,
                        "max": 21.705625,
                        "mean": 2.0312216700000003,
                        "min": 0.452792,
                        "p50": 0.866042,
                        "p80": 2.338042,
                        "p90": 3.867042,
                        "p95": 7.000625,
                        "p99": 14.118209
                    },
                    "setPlayerName": {
                        "count": 50,
                        "max": 20.375792,
                        "mean": 1.7612491800000003,
                        "min": 0.371333,
                        "p50": 0.734125,
                        "p80": 1.332084,
                        "p90": 1.560917,
                        "p95": 14.288541,
                        "p99": 20.375792
                    },
                    "updatePosition": {
                        "count": 250,
                        "max": 71.892458,
                        "mean": 4.023490696000001,
                        "min": 0.308792,
                        "p50": 0.873584,
                        "p80": 3.020917,
                        "p90": 11.494542,
                        "p95": 19.663084,
                        "p99": 54.764625
                    }
                },
                "summary": {
                    "averageExecutionTime": 3.242643250000001,
                    "maxExecutionTime": 71.892458,
                    "minExecutionTime": 0.308792,
                    "p50": 0.863708,
                    "p80": 2.232416,
                    "p90": 9.164791,
                    "p95": 14.288541,
                    "p99": 46.193875,
                    "totalEvents": 400
                }
            },
            "response": {
                "eventStats": {
                    "Chat": {
                        "count": 100,
                        "max": 9.040166,
                        "mean": 2.3098683399999995,
                        "min": 1.008583,
                        "p50": 1.729583,
                        "p80": 3.097625,
                        "p90": 4.070959,
                        "p95": 5.182166,
                        "p99": 7.31275
                    },
                    "Disconnect": {
                        "count": 50,
                        "max": 6.112792,
                        "mean": 1.5421792599999997,
                        "min": 0.436416,
                        "p50": 1.093375,
                        "p80": 2.219333,
                        "p90": 2.721916,
                        "p95": 3.649041,
                        "p99": 6.112792
                    },
                    "Join": {
                        "count": 50,
                        "max": 9.279541,
                        "mean": 2.41773002,
                        "min": 0.91625,
                        "p50": 1.874083,
                        "p80": 2.893208,
                        "p90": 3.312875,
                        "p95": 6.660917,
                        "p99": 9.279541
                    },
                    "Name": {
                        "count": 50,
                        "max": 8.731458,
                        "mean": 1.8585383000000002,
                        "min": 0.605458,
                        "p50": 1.485833,
                        "p80": 2.466541,
                        "p90": 3.061459,
                        "p95": 3.837209,
                        "p99": 8.731458
                    },
                    "Position": {
                        "count": 250,
                        "max": 51.931334,
                        "mean": 5.740406056000001,
                        "min": 0.949875,
                        "p50": 2.420541,
                        "p80": 5.808792,
                        "p90": 21.592917,
                        "p95": 22.88725,
                        "p99": 51.930959
                    }
                },
                "summary": {
                    "averageExecutionTime": 3.9140214540000002,
                    "maxExecutionTime": 51.931334,
                    "minExecutionTime": 0.436416,
                    "p50": 1.911083,
                    "p80": 3.761667,
                    "p90": 7.31275,
                    "p95": 21.592917,
                    "p99": 27.725292,
                    "totalEvents": 500
                }
            }
        },
        "success": true,
        "system": {
            "duration": {
                "end": "2024. 12. 22. 오후 7:42:28",
                "seconds": "22.992s",
                "start": "2024. 12. 22. 오후 7:42:05"
            }
        },
        "throughput": {
            "request": {
                "avgThroughput": 29.39,
                "durationSeconds": 13.61,
                "peakThroughput": 117
            },
            "response": {
                "avgThroughput": 35.44,
                "durationSeconds": 14.11,
                "peakThroughput": 116
            }
        }
    }

🎯 리뷰 요구사항 (선택)

  • 특별히 봐줬으면 하는 부분이 있다면 적어주세요

✅ Check List

  • merge할 브랜치의 위치를 확인했나요?
  • Label을 지정했나요?

@NewCodes7 NewCodes7 self-assigned this Dec 22, 2024
@Copilot Copilot bot review requested due to automatic review settings December 22, 2024 10:49

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 15 changed files in this pull request and generated no comments.

Files not reviewed (10)
  • BE/package-lock.json: Language not supported
  • BE/package.json: Language not supported
  • BE/src/game/service/game.chat.service.ts: Evaluated as low risk
  • BE/src/common/interceptor/SocketEventLoggerInterceptor.ts: Evaluated as low risk
  • BE/src/game/game.gateway.ts: Evaluated as low risk
  • BE/src/game/game.module.ts: Evaluated as low risk
  • BE/src/game/interceptor/gameActivity.interceptor.ts: Evaluated as low risk
  • BE/src/game/redis/subscribers/player.subscriber.ts: Evaluated as low risk
  • BE/src/app.module.ts: Evaluated as low risk
  • BE/src/game/service/game.service.ts: Evaluated as low risk
Comments suppressed due to low confidence (2)

BE/src/metric/metric.service.ts:215

  • The calculateSystemStats method has commented-out code that should either be removed or uncommented if it's necessary.
private calculateSystemStats(startSystemMetrics: SystemMetricSnapshot, systemSnapshots: SystemMetricSnapshot[]) {

BE/src/metric/metric.service.ts:282

  • The calculatePercentile method returns 0 if the sortedValues array is empty. This might be intended, but we should confirm.
if (sortedValues.length === 0) return 0;
@NewCodes7 NewCodes7 requested a review from Copilot December 22, 2024 10:51

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 15 changed files in this pull request and generated no comments.

Files not reviewed (10)
  • BE/package-lock.json: Language not supported
  • BE/package.json: Language not supported
  • BE/src/metric/metric.controller.ts: Evaluated as low risk
  • BE/src/game/interceptor/gameActivity.interceptor.ts: Evaluated as low risk
  • BE/src/game/redis/subscribers/player.subscriber.ts: Evaluated as low risk
  • BE/src/game/service/game.chat.service.ts: Evaluated as low risk
  • BE/src/game/service/game.service.ts: Evaluated as low risk
  • BE/src/metric/interfaces/metric.interface.ts: Evaluated as low risk
  • BE/src/metric/metric.interceptor.ts: Evaluated as low risk
  • BE/src/metric/metric.module.ts: Evaluated as low risk
Comments suppressed due to low confidence (1)

BE/src/game/game.gateway.ts:30

  • The new MetricInterceptor functionality is not covered by tests. Ensure that the metrics collection is properly tested.
@UseInterceptors(MetricInterceptor)
@NewCodes7 NewCodes7 merged commit 7309170 into boostcampwm-2024:dev-be Dec 23, 2024
0 of 2 checks passed
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.

4 participants