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

Feature/#125 #127

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@ FROM openjdk:21
ARG JAR_FILE=build/libs/*.jar
COPY ${JAR_FILE} app.jar

ARG PROFILE=local
ARG apm_agent=apm-agent/*.jar
COPY ${apm_agent} apm-agent.jar

ARG PROFILE=dev
ENV SPRING_PROFILES_ACTIVE=${PROFILE}

ENTRYPOINT ["java","-jar","/app.jar"]
ENTRYPOINT ["java", \
"-javaagent:/apm-agent.jar", \
"-Delastic.apm.server_urls=http://114.70.23.79:8200", \
"-Delastic.apm.service_name=boot-apm-agent", \
"-Delastic.apm.application_packages=com.server", \
"-Delastic.apm.environment=dev", \
"-jar", \
"/app.jar"]
Binary file added apm-agent/Elastic_APM_Agent_1.52.0.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.server.bbo_gak.global.error.exception.ErrorCode;
import com.server.bbo_gak.global.error.exception.NotFoundException;
import io.jsonwebtoken.JwtException;
import io.sentry.Sentry;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -21,6 +22,8 @@ protected ResponseEntity<ErrorResponse> handleBusinessException(final BusinessEx
log.error("handleBusinessException", exception);
final ErrorCode errorCode = exception.getErrorCode();
final ErrorResponse response = ErrorResponse.from(errorCode);
Sentry.captureException(exception);

return new ResponseEntity<>(response, errorCode.getStatus());
}

Expand All @@ -34,6 +37,8 @@ protected ResponseEntity<ErrorResponse> handleEntityNotFoundException(final NotF
log.error("handleEntityNotFoundException", exception);
final ErrorCode errorCode = exception.getErrorCode();
final ErrorResponse response = ErrorResponse.from(exception.getErrorCode());
Sentry.captureException(exception);

return new ResponseEntity<>(response, errorCode.getStatus());
}

Expand All @@ -42,6 +47,8 @@ protected ResponseEntity<ErrorResponse> handleEntityNotFoundException(final NotF
protected ResponseEntity<ErrorResponse> handleException(final Exception exception) {
log.error(exception.getMessage(), exception);
final ErrorResponse response = ErrorResponse.from(ErrorCode.INTERNAL_SERVER_ERROR);
Sentry.captureException(exception);

return new ResponseEntity<>(response, response.getStatus());
}

Expand All @@ -50,6 +57,8 @@ protected ResponseEntity<ErrorResponse> handleJwtException(final JwtException ex
log.error("handleEntityNotFoundException", exception);
final ErrorCode errorCode = ErrorCode.RT_NOT_FOUND;
final ErrorResponse response = ErrorResponse.from(errorCode);
Sentry.captureException(exception);

return new ResponseEntity<>(response, errorCode.getStatus());
}
}
1 change: 0 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ scheduler:

sentry:
dsn: ${SENTRY_DSN}
exception-resolver-order: -2147483647
enable-tracing: true
tracesSampleRate: 1.0
debug: true
Expand Down
Loading