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

Feat/#72 AWS Lamda 테스트 환경 만들기 #79

Merged
merged 4 commits into from
Aug 18, 2024
Merged

Feat/#72 AWS Lamda 테스트 환경 만들기 #79

merged 4 commits into from
Aug 18, 2024

Conversation

LuizyHub
Copy link
Member

@LuizyHub LuizyHub commented Aug 18, 2024

🚀 작업 내용

  • 람다 개발 환경 세팅
  • 람다 코드 작성
  • 람다 사용법 및 사용 예시 추가
  • 통계 제공
    • 요청 평균 시간
    • 최대 시간
    • 최소 시간
    • 성공 개수
    • 실패 개수
    • 총 실행시간
    • 각 요청별 오래걸린 순으로 정렬된 시간 리스트
  • 개발위키 Lamda 세팅해보기 (TypeScript) 작성

📸 이슈 번호

사용법

curl --location 'https://your-lambda-url/' \
--header 'Content-Type: application/json' \
--data '{
    "appKey": "{appKey}",
    "repeat": 10
}'

응답 예시

{
  "averageTime": 32.77718769300003,
  "maxTime": 1909.24762,
  "minTime": 6.588578999999299,
  "successCount": 1000,
  "failureCount": 0,
  "totalExecutionTime": 32800.551787000004,
  "memoryUsed": "128 MB",
  "requestId": "3c269a70-b0ba-4912-88f0-f61e5dee018c",
  "timings": [
    {
      "index": 0,
      "time": 1909.24762,
      "statusCode": 201
    },
    {
      "index": 897,
      "time": 618.7067969999989,
      "statusCode": 201
    },
    {
      "index": 563,
      "time": 400.04752400000143,
      "statusCode": 201
    },
    {
      "index": 214,
      "time": 380.8735259999994,
      "statusCode": 201
    },
    {
      "index": 1,
      "time": 351.5926810000001,
      "statusCode": 201
    },
    {
      "index": 4,
      "time": 339.9373370000003,
      "statusCode": 201
    },
    {
      "index": 20,
      "time": 339.90371999999934,
      "statusCode": 201
    },
    {
      "index": 895,
      "time": 220.41194600000017,
      "statusCode": 201
    },
    {
      "index": 564,
      "time": 212.24562899999728,
      "statusCode": 201
    },
    {
      "index": 8,
      "time": 200.19748899999968,
      "statusCode": 201
    },
    {
      "index": 15,
      "time": 200.19742299999962,
      "statusCode": 201
    },
    {
      "index": 10,
      "time": 199.67243499999995,
      "statusCode": 201
    },
    {
      "index": 6,
      "time": 199.41130600000042,
      "statusCode": 201
    },
    {
      "index": 12,
      "time": 180.20744199999945,
      "statusCode": 201
    },
    {
      "index": 9,
      "time": 180.0771120000004,
      "statusCode": 201
    }
  ]
}

- npm init
- add `@types/aws-lambda` devDependencies
- 요청을 "repeat" 횟수만큼 전송
- 통계를 응답
@LuizyHub LuizyHub added the ⭐️ Feat 새로운 기능이나 요청 label Aug 18, 2024
@LuizyHub LuizyHub requested a review from a team August 18, 2024 09:14
Copy link

Risk Level 3 - /home/runner/work/Team5-Guys/Team5-Guys/lamda/src/index.ts

  1. The use of 'appKey' in the headers is a potential security risk if it contains sensitive information. Consider using environment variables or a secure vault to manage API keys.

  2. The error handling in the fetch request could be improved. Instead of just setting statusCode to 500 on catch, consider logging the error for better debugging. Example:

    catch (error) {
        console.error('Fetch error:', error);
        statusCode = 500;
        failureCount++;
    }
    
  3. The code could benefit from more descriptive variable names. For instance, 'repeat' could be renamed to 'repeatCount' for clarity.


🔒📈📝


Powered by Code Review GPT

@LuizyHub LuizyHub self-assigned this Aug 18, 2024
Copy link
Member

Choose a reason for hiding this comment

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

너무 친절해요 👍🏻

Copy link
Member

Choose a reason for hiding this comment

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

통계 시간 로직까지 좋습니다 👍🏻

Copy link
Member

@tidavid1 tidavid1 left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏻

@tidavid1 tidavid1 merged commit 8b95f93 into dev Aug 18, 2024
1 check passed
@tidavid1 tidavid1 deleted the feat/#72 branch August 18, 2024 15:27
LuizyHub added a commit that referenced this pull request Aug 19, 2024
* config: init proiject

- npm init
- add `@types/aws-lambda` devDependencies

* config: lamda에 맞게 개발환경 세팅

* feature: 람다 코드 작성

- 요청을 "repeat" 횟수만큼 전송
- 통계를 응답

* docs: 사용법 & 예시 추가
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐️ Feat 새로운 기능이나 요청
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants