Skip to content

fix(filter): GraphQL 에러 중복 로깅 제거 (#117 follow-up)#118

Merged
chanwoo7 merged 1 commit into
developfrom
fix/gql-error-double-logging
May 28, 2026
Merged

fix(filter): GraphQL 에러 중복 로깅 제거 (#117 follow-up)#118
chanwoo7 merged 1 commit into
developfrom
fix/gql-error-double-logging

Conversation

@chanwoo7
Copy link
Copy Markdown
Member

Summary

#117 (P1-3 GraphQL 전용 예외 필터) Codex 리뷰 후속. GraphQL 에러가 GqlLoggingInterceptor.tap.errorGraphQLExceptionFilter.format 양쪽에서 txError 를 호출해 동일 요청/에러에 대한 중복 로그가 발생하던 문제 수정.

Scope

  • gql-logging.interceptor.ts
    • tap.error 콜백에서 this.logger.txError({...}) 호출 제거
    • setResponseTimeHeader(res, duration) 호출은 유지 (에러 응답에서도 응답 시간 헤더 누락 방지)
    • 결과: 에러 로깅 owner 가 GraphQLExceptionFilter 단일화 — HTTP path (HttpLoggingInterceptor + HttpExceptionFilter) 와 동일 패턴
  • gql-logging.interceptor.spec.ts
    • 기존 "에러 시 txError 로그에 메시지 포함" / "Error 인스턴스 아닐 때 Unknown error 로깅" 케이스 제거
    • 신규 케이스 2개 추가
      • "에러 시 txError 는 호출되지 않는다 (GraphQLExceptionFilter 가 담당)" — 중복 로깅 회귀 가드
      • "에러 시에도 setResponseTimeHeader 는 호출된다" — 응답 시간 헤더 보존 가드

원인 분석

Path 인터셉터 (성공 tx) 인터셉터 (에러 txError) 필터 (txError)
HTTP ✅ HttpLoggingInterceptor ❌ (없음) ✅ HttpExceptionFilter
GraphQL (Before) ✅ GqlLoggingInterceptor ⚠️ 중복 ✅ GraphQLExceptionFilter
GraphQL (After) ✅ GqlLoggingInterceptor ❌ (제거) ✅ GraphQLExceptionFilter

Impact

  • FE: 없음 (응답 형태/내용 불변)
  • DB: 변경 없음
  • 운영 로그: GraphQL 에러 요청당 txError 1 건 → 1 건 (중복 0). 에러 카운터·알람 inflation 해소
  • Coverage: pre-push validate gate 통과 (전체 1191 테스트)

Test plan

  • gql-logging.interceptor.spec — 에러 시 txError 미호출 + setResponseTimeHeader 호출 검증
  • graphql-exception.filter.spec — 기존 16 케이스 그대로 통과 (필터의 txError 로깅 보존)
  • pre-push gate (yarn validate) 로컬 통과
  • CI 통과 확인

GqlLoggingInterceptor 의 tap.error 와 GraphQLExceptionFilter.format 모두
txError 를 호출해 같은 요청/에러가 두 번 로깅되던 문제 수정.

HTTP path (HttpLoggingInterceptor + HttpExceptionFilter) 패턴과 동일하게
에러 로깅 owner 는 필터로 일관화. 인터셉터는 성공 tx 로깅과
응답 시간 헤더 (성공/에러 양쪽) 만 담당.

- gql-logging.interceptor.ts: tap.error 에서 txError 제거, setResponseTimeHeader 만 유지
- spec: 중복 txError 미호출 + setResponseTimeHeader 호출 보존 검증

Codex 리뷰 (#117 inline) 지적 반영.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0d6f4ccd-c8b7-468a-8916-9fc2b33c2dc5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/gql-error-double-logging

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 97.33% 3541/3638
🟢 Branches 93.51% 1124/1202
🟢 Functions 93.62% 646/690
🟢 Lines 97.56% 3241/3322

Test suite run success

1191 tests passing in 143 suites.

Report generated by 🧪jest coverage report action from 2615d19

@chanwoo7 chanwoo7 merged commit 04d3c28 into develop May 28, 2026
10 checks passed
@chanwoo7 chanwoo7 deleted the fix/gql-error-double-logging branch May 28, 2026 11:31
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.

1 participant