RED-1137: Do not observe actuator endpoints
This commit is contained in:
parent
a64a451090
commit
8d03edf378
6
pom.xml
6
pom.xml
@ -44,6 +44,12 @@
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<optional>true</optional>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Miscellaneous -->
|
||||
<dependency>
|
||||
|
||||
@ -1,17 +1,38 @@
|
||||
package com.knecon.fforesight.tracing;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.ConditionalOnEnabledTracing;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.http.server.observation.ServerRequestObservationContext;
|
||||
|
||||
import io.micrometer.observation.ObservationPredicate;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
@Slf4j
|
||||
@ComponentScan
|
||||
@AutoConfiguration
|
||||
public class DefaultTracingAutoConfiguration {
|
||||
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
|
||||
log.info("Tracing AutoConfiguration Loaded!");
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
@ConditionalOnEnabledTracing
|
||||
ObservationPredicate actuatorServerContextPredicate() {
|
||||
|
||||
// There might be a better solution soon: https://github.com/spring-projects/spring-boot/issues/34801
|
||||
return (name, context) -> {
|
||||
if (name.equals("http.server.requests") && context instanceof ServerRequestObservationContext serverContext) {
|
||||
return !serverContext.getCarrier().getRequestURI().startsWith("/actuator");
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user