-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ignore tracing for specific routes
- Loading branch information
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
api-gateway/src/main/java/kr/mafoo/gateway/TracingConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package kr.mafoo.gateway; | ||
|
||
import io.micrometer.observation.ObservationPredicate; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.server.reactive.ServerHttpRequest; | ||
import org.springframework.http.server.reactive.observation.ServerRequestObservationContext; | ||
|
||
@Configuration | ||
public class TracingConfig { | ||
@Bean | ||
ObservationPredicate noopServerRequestObservationPredicate() { | ||
ObservationPredicate predicate = (name, context) -> { | ||
if(context instanceof ServerRequestObservationContext c) { | ||
ServerHttpRequest servletRequest = c.getCarrier(); | ||
String requestURI = servletRequest.getPath().toString(); | ||
if(StringUtils.containsAny(requestURI, "actuator", "swagger", "api-docs")) { | ||
return false; | ||
} | ||
} | ||
if (StringUtils.equalsAny(name,"spring.security.filterchains","spring.security.authorizations","spring.security.http.secured.requests")) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
|
||
return predicate; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
photo-service/src/main/java/kr/mafoo/photo/config/TracingConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package kr.mafoo.photo.config; | ||
|
||
import io.micrometer.observation.ObservationPredicate; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.server.reactive.ServerHttpRequest; | ||
import org.springframework.http.server.reactive.observation.ServerRequestObservationContext; | ||
|
||
@Configuration | ||
public class TracingConfig { | ||
@Bean | ||
ObservationPredicate noopServerRequestObservationPredicate() { | ||
ObservationPredicate predicate = (name, context) -> { | ||
if(context instanceof ServerRequestObservationContext c) { | ||
ServerHttpRequest servletRequest = c.getCarrier(); | ||
String requestURI = servletRequest.getPath().toString(); | ||
if(StringUtils.containsAny(requestURI, "actuator", "swagger", "api-docs")) { | ||
return false; | ||
} | ||
} | ||
if (StringUtils.equalsAny(name,"spring.security.filterchains","spring.security.authorizations","spring.security.http.secured.requests")) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
|
||
return predicate; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
user-service/src/main/java/kr/mafoo/user/config/TracingConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package kr.mafoo.user.config; | ||
|
||
import io.micrometer.observation.ObservationPredicate; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.server.reactive.ServerHttpRequest; | ||
import org.springframework.http.server.reactive.observation.ServerRequestObservationContext; | ||
|
||
@Configuration | ||
public class TracingConfig { | ||
@Bean | ||
ObservationPredicate noopServerRequestObservationPredicate() { | ||
ObservationPredicate predicate = (name, context) -> { | ||
if(context instanceof ServerRequestObservationContext c) { | ||
ServerHttpRequest servletRequest = c.getCarrier(); | ||
String requestURI = servletRequest.getPath().toString(); | ||
if(StringUtils.containsAny(requestURI, "actuator", "swagger", "api-docs")) { | ||
return false; | ||
} | ||
} | ||
if (StringUtils.equalsAny(name,"spring.security.filterchains","spring.security.authorizations","spring.security.http.secured.requests")) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
|
||
return predicate; | ||
} | ||
} |