fixing Trace Bullet

This commit is contained in:
2025-09-15 21:23:33 +02:00
parent ea560fc221
commit f81e52388c
17 changed files with 331 additions and 25 deletions
@@ -1,12 +1,12 @@
package at.mocode.temp.pingservice
import org.springframework.web.bind.annotation.CrossOrigin
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter
@RestController
@CrossOrigin(origins = ["http://localhost:8080"])
class PingController(
private val pingService: PingServiceCircuitBreaker
) {
@@ -17,7 +17,12 @@ class PingController(
*/
@GetMapping("/ping", "/ping/ping")
fun ping(): Map<String, String> {
return mapOf("status" to "pong")
val now = OffsetDateTime.now().format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
return mapOf(
"status" to "pong",
"timestamp" to now,
"service" to "ping-service"
)
}
/**
@@ -18,10 +18,19 @@ management:
endpoints:
web:
exposure:
include: health,info,circuitbreakers
include: health,info,metrics,prometheus,circuitbreakers
endpoint:
health:
show-details: always
probes:
enabled: true
tracing:
enabled: true
sampling:
probability: ${TRACING_SAMPLING_PROBABILITY:1.0}
zipkin:
tracing:
endpoint: ${ZIPKIN_TRACING_ENDPOINT:http://zipkin:9411/api/v2/spans}
# Resilience4j Circuit Breaker Configuration
resilience4j:
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="LOG_PATTERN" value="%d{ISO8601} %-5level [%X{traceId:-}:%X{spanId:-}] %logger{36} - %msg%n"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<logger name="org.springframework" level="INFO"/>
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springframework.boot.actuate" level="INFO"/>
<logger name="reactor.netty" level="WARN"/>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
</root>
</configuration>