From 00f560a41175cc31c67b313d4da0fce19c22fdfd Mon Sep 17 00:00:00 2001 From: pricelees Date: Mon, 28 Jul 2025 15:46:46 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Observability=20=EC=9D=98=EC=A1=B4?= =?UTF-8?q?=EC=84=B1=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=20=ED=98=95=EC=8B=9D=EC=97=90=20traceId,=20spanId=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 7 +++++++ src/main/resources/application-local.yaml | 7 ++++++- src/main/resources/application.yaml | 3 +++ src/main/resources/logback-local.xml | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 0db9d916..ae046cbe 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -47,8 +47,15 @@ dependencies { // Logging implementation("io.github.oshai:kotlin-logging-jvm:7.0.3") implementation("net.logstash.logback:logstash-logback-encoder:8.1") + implementation("com.github.loki4j:loki-logback-appender:2.0.0") implementation("net.ttddyy.observation:datasource-micrometer-spring-boot:1.1.1") + // Observability + implementation("org.springframework.boot:spring-boot-starter-actuator") + implementation("io.micrometer:micrometer-tracing-bridge-otel") + implementation("io.opentelemetry:opentelemetry-exporter-otlp") + runtimeOnly("io.micrometer:micrometer-registry-prometheus") + // Kotlin implementation("org.jetbrains.kotlin:kotlin-reflect") implementation("com.fasterxml.jackson.module:jackson-module-kotlin") diff --git a/src/main/resources/application-local.yaml b/src/main/resources/application-local.yaml index 200aec25..9a8b7f2d 100644 --- a/src/main/resources/application-local.yaml +++ b/src/main/resources/application-local.yaml @@ -37,4 +37,9 @@ jdbc: log-level: DEBUG logger-name: query-logger multiline: true - includes: connection,query,keys,fetch \ No newline at end of file + includes: connection,query,keys,fetch + +management: + tracing: + sampling: + probability: 1 \ No newline at end of file diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 99f1feb3..172ae72c 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -1,3 +1,6 @@ +server: + forward-headers-strategy: framework + spring: profiles: active: ${ACTIVE_PROFILE:local} diff --git a/src/main/resources/logback-local.xml b/src/main/resources/logback-local.xml index 440c5649..fb0a2202 100644 --- a/src/main/resources/logback-local.xml +++ b/src/main/resources/logback-local.xml @@ -4,7 +4,7 @@ class="roomescape.common.log.RoomescapeLogMaskingConverter"/> + value="%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) %green(${PID:- }) --- [%15.15thread] [%magenta(%X{traceId:-},%X{spanId:-})] %cyan(%-40logger{36}) : %maskedMessage%n%throwable"/>