From 640d40c78adc718e5ac343c44216e3327c3a07d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=82=98=EB=AF=B8?= Date: Tue, 21 Jul 2026 20:11:51 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20OTel=20agent=20=EA=B0=90=EC=A7=80=20?= =?UTF-8?q?=EC=8B=9C=20-javaagent=20=EC=9E=90=EB=8F=99=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit grafana-opentelemetry-java.jar와 otel.env가 배포 서버에 있으면 자동으로 감지해서 -javaagent 옵션을 붙여 실행. 없으면 기존과 동일하게 부팅. --- scripts/deploy.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index e1f60e8..3a871eb 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -16,7 +16,20 @@ else fi echo "> 애플리케이션 시작" -nohup java -jar \ +OTEL_AGENT_JAR=$APP_DIR/grafana-opentelemetry-java.jar +OTEL_ENV_FILE=$APP_DIR/otel.env +JAVA_AGENT_OPTS="" +if [ -f "$OTEL_AGENT_JAR" ] && [ -f "$OTEL_ENV_FILE" ]; then + echo "> Grafana OTel agent 감지, 모니터링 활성화" + set -a + source "$OTEL_ENV_FILE" + set +a + JAVA_AGENT_OPTS="-javaagent:$OTEL_AGENT_JAR" +else + echo "> Grafana OTel agent 미설정, 모니터링 없이 실행" +fi + +nohup java $JAVA_AGENT_OPTS -jar \ -Duser.timezone=Asia/Seoul \ $JAR_PATH \ >> /home/ec2-user/app/nohup.out 2>&1 &