-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: sentry 플러그인 추가 * chore: Sentry 프로파일 추가 * chore: 도커 이미지 태그를 환경변수로 받아서 매핑 * chore: 도커 이미지 태그를 센트리 포맷에 맞춰서 바인딩 * style: spotless 적용 * chore: 로그백 센트리 디펜던시 추가 * chore: 사용자 정보 로깅 추가 * feat: 메서드 이름 변경 및 출력문 제거
- Loading branch information
Showing
7 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/com/gdschongik/gdsc/global/config/SentryConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
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(convertTagToRelease(dockerProperty.getTag())); | ||
}; | ||
} | ||
|
||
// gdscrepo/gdsc-server:v1.0.0 -> [email protected] | ||
// gdscrepo/gdsc-server:ffffff -> gdsc-server@ffffff | ||
private String convertTagToRelease(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 | ||
} | ||
return split[0] + "@" + version; // [email protected] | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/gdschongik/gdsc/global/property/DockerProperty.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.gdschongik.gdsc.global.property; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
@ConfigurationProperties(prefix = "docker") | ||
public class DockerProperty { | ||
private final String tag; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
spring: | ||
config: | ||
activate: | ||
on-profile: "sentry" | ||
|
||
sentry: | ||
dsn: ${SENTRY_DSN:} | ||
traces-sample-rate: 1.0 | ||
exception-resolver-order: -2147483647 | ||
environment: ${spring.profiles.active:local} | ||
send-default-pii: true | ||
logging: | ||
minimum-event-level: info | ||
minimum-breadcrumb-level: debug | ||
|
||
docker: | ||
tag: ${DOCKER_IMAGE_TAG:} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ spring: | |
- payment | ||
- github | ||
- sentry | ||
|
||
logging: | ||
level: | ||
|