-
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: 불필요한 예외 캡쳐 대상에서 제외 * chore: warn 레벨부터 캡쳐 * chore: 액추에이터 엔드포인트 이벤트 전송 제외 * docs: 주석 수정
- Loading branch information
Showing
4 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
src/main/java/com/gdschongik/gdsc/global/common/constant/SentryConstant.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.common.constant; | ||
|
||
import java.util.List; | ||
|
||
public class SentryConstant { | ||
|
||
private SentryConstant() {} | ||
|
||
public static final String ACTUATOR_KEYWORD = "actuator"; | ||
|
||
public static final List<String> KEYWORDS_TO_IGNORE = List.of(ACTUATOR_KEYWORD); | ||
} |
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
28 changes: 28 additions & 0 deletions
28
src/main/java/com/gdschongik/gdsc/infra/sentry/CustomBeforeSendTransactionCallback.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,28 @@ | ||
package com.gdschongik.gdsc.infra.sentry; | ||
|
||
import static com.gdschongik.gdsc.global.common.constant.SentryConstant.*; | ||
|
||
import io.sentry.Hint; | ||
import io.sentry.SentryOptions; | ||
import io.sentry.protocol.SentryTransaction; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class CustomBeforeSendTransactionCallback implements SentryOptions.BeforeSendTransactionCallback { | ||
|
||
@Override | ||
public SentryTransaction execute(@NotNull SentryTransaction transaction, @NotNull Hint hint) { | ||
String transactionEndpoint = transaction.getTransaction(); | ||
|
||
if (transactionEndpoint == null) { | ||
return transaction; | ||
} | ||
|
||
if (KEYWORDS_TO_IGNORE.stream().anyMatch(transactionEndpoint::contains)) { | ||
return null; | ||
} | ||
|
||
return transaction; | ||
} | ||
} |
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