spring cloud sleuth

์ƒ์„ฑ์ผ: 2022๋…„ 12์›” 7์ผ ์˜ค์ „ 10:43

Spring Cloud Sleuth

Spring Cloud Sleuth Reference Documentation

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${release.train.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-sleuth</artifactId>
    </dependency>
</dependencies>
  • ๋ฒ„์ „๋ณ„๋กœ ์ž˜ ์„ค์น˜ ํ•ด์•ผํ•จ


<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <pattern>[%d{yyyy-MM-dd HH:mm:ss}:%-3relative][%thread{10}, %X{traceId:-}, %X{spanId:-}] %-5level %logger{36} - %msg%n</pattern>
        </encoder>
    </appender>
  • %X{traceId:-}, %X{spanId:-} : traceID & spanID ๋กœ๊ทธ๋กœ ์ฐ์–ด์คŒ

@Autowired
private Tracer tracer;

Span span = tracer.currentSpan();
if (span != null) {
			log.info("Trace ID {}", span.context().traceId());
      log.info("Span ID {}", span.context().spanId());
}
  • ์ด๋Ÿฐ์‹์œผ๋กœ ์ปจํŠธ๋กค๋Ÿฌ์—์„œ ๋ฐ›์•„์˜ฌ ์ˆ˜ ์žˆ์Œ

์ฐธ๊ณ 

Spring MVC Stack - Logging With AOP + MDC

Spring Boot ๊ฐœ๋ฐœ ์‹œ sleuth, zipkin์„ ํ™œ์šฉํ•œ ๋ถ„์‚ฐ์ถ”์ ํ™˜๊ฒฝ ๊ตฌ์ถ•

[๋ฒˆ์—ญ] Spring Cloud Sleuth (1) Introduction

LINE ๊ด‘๊ณ  ํ”Œ๋žซํผ์˜ MSA ํ™˜๊ฒฝ์—์„œ Zipkin์„ ํ™œ์šฉํ•ด ๋กœ๊ทธ ํŠธ๋ ˆ์ด์‹ฑํ•˜๊ธฐ

Spring Boot ๊ฐœ๋ฐœ ์‹œ sleuth, zipkin์„ ํ™œ์šฉํ•œ ๋ถ„์‚ฐ์ถ”์ ํ™˜๊ฒฝ ๊ตฌ์ถ•

Last updated