-
Notifications
You must be signed in to change notification settings - Fork 1
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
chore: Sentry 에러 모니터링 적용 #707
Conversation
Walkthrough이 변경 사항은 Sentry 에러 모니터링을 애플리케이션에 통합하기 위해 여러 파일에서 수정이 이루어졌습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant App as Application
participant Sentry as Sentry Service
participant Docker as Docker Configuration
App->>Docker: Retrieve Docker properties
Docker-->>App: Provide Docker image tag
App->>Sentry: Configure Sentry with Docker image tag
Sentry-->>App: Setup error tracking and monitoring
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Job Summary for GradleCheck Style and Test to Develop :: build-test
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (7)
- build.gradle (2 hunks)
- docker-compose.yml (1 hunks)
- src/main/java/com/gdschongik/gdsc/global/config/PropertyConfig.java (2 hunks)
- src/main/java/com/gdschongik/gdsc/global/config/SentryConfig.java (1 hunks)
- src/main/java/com/gdschongik/gdsc/global/property/DockerProperty.java (1 hunks)
- src/main/resources/application-sentry.yml (1 hunks)
- src/main/resources/application.yml (1 hunks)
Files skipped from review due to trivial changes (1)
- src/main/resources/application.yml
Additional comments not posted (7)
src/main/java/com/gdschongik/gdsc/global/property/DockerProperty.java (1)
1-12
: Spring 빈 등록 확인 필요
DockerProperty
클래스가 Spring 빈으로 등록되었는지 확인하는 것이 좋습니다. 이를 위해@ConfigurationPropertiesScan
또는@EnableConfigurationProperties
어노테이션을 사용하여 해당 클래스를 스캔하도록 설정해야 합니다.src/main/resources/application-sentry.yml (1)
1-17
: Sentry DSN 환경 변수 설정 확인 필요Sentry DSN이 환경 변수에 올바르게 설정되었는지 확인하는 것이 좋습니다. 설정되지 않은 경우 Sentry 에러 모니터링이 제대로 작동하지 않을 수 있습니다.
docker-compose.yml (1)
13-13
: 환경 변수 설정 확인 필요
IMAGE_FULL_URL
환경 변수가 올바르게 설정되었는지 확인하는 것이 좋습니다. 설정되지 않은 경우 Docker 이미지 태그가 제대로 적용되지 않을 수 있습니다.src/main/java/com/gdschongik/gdsc/global/config/PropertyConfig.java (2)
5-5
: LGTM!
DockerProperty
를 가져오는 것은 올바르며 추가된 기능에 필요합니다.코드 변경 사항이 승인되었습니다.
21-22
: LGTM!
DockerProperty
를@EnableConfigurationProperties
에 추가하는 것은 Docker 관련 속성을 관리할 수 있도록 합니다.코드 변경 사항이 승인되었습니다.
build.gradle (2)
7-7
: LGTM!Sentry Gradle 플러그인이 올바르게 추가되었습니다.
코드 변경 사항이 승인되었습니다.
101-101
: LGTM!Sentry Logback 의존성이 올바르게 추가되었습니다.
코드 변경 사항이 승인되었습니다.
package com.gdschongik.gdsc.global.config; | ||
|
||
import com.gdschongik.gdsc.global.property.DockerProperty; | ||
import io.sentry.Sentry; | ||
import io.sentry.SentryOptions; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
@RequiredArgsConstructor | ||
public class SentryConfig { | ||
|
||
private final DockerProperty dockerProperty; | ||
|
||
@Bean | ||
Sentry.OptionsConfiguration<SentryOptions> customOptionsConfiguration() { | ||
return options -> { | ||
options.setRelease(convertTagToVersion(dockerProperty.getTag())); | ||
}; | ||
} | ||
|
||
// gdscrepo/gdsc-server:v1.0.0 -> [email protected] | ||
// gdscrepo/gdsc-server:ffffff -> gdsc-server@ffffff | ||
private String convertTagToVersion(String tag) { | ||
if (tag.isBlank()) { | ||
return "gdsc-server"; | ||
} | ||
|
||
String imageWithVersion = tag.split("/")[1]; // gdsc-server:v1.0.0 | ||
String[] split = imageWithVersion.split(":"); // [gdsc-server, v1.0.0] | ||
String version = split[1]; // v1.0.0 or ffffff (commit hash) | ||
if (version.startsWith("v")) { | ||
version = version.substring(1); // 1.0.0 | ||
} | ||
String s = split[0] + "@" + version; // [email protected] | ||
System.out.println("s = " + s); | ||
return s; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Sentry 설정 파일이 올바르게 구현되었습니다. 그러나 몇 가지 개선 사항을 제안합니다.
convertTagToVersion
메서드에서System.out.println
대신 로깅 프레임워크를 사용하세요.convertTagToVersion
메서드의split
사용을 더 안전하게 처리할 수 있습니다.
- System.out.println("s = " + s);
+ log.info("Converted tag to version: {}", s);
+ if (split.length < 2) {
+ throw new IllegalArgumentException("Invalid tag format");
+ }
Job Summary for GradleCheck Style and Test to Develop :: build-test
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/main/java/com/gdschongik/gdsc/global/config/SentryConfig.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/main/java/com/gdschongik/gdsc/global/config/SentryConfig.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
🌱 관련 이슈
📌 작업 내용 및 특이사항
log.warn
같은 것들은 logback으로 캡쳐합니다.log.error
로 잡히기 떄문에 별도로 captureException을 호출해줄 필요가 없습니다.📝 참고사항
📚 기타
Summary by CodeRabbit
New Features
DockerProperty
클래스를 도입했습니다.application-sentry.yml
파일을 추가하여 Sentry 설정을 구성할 수 있도록 하였습니다.Bug Fixes