优化监控配置
This commit is contained in:
parent
ee3557370f
commit
5dfdd61cf7
|
|
@ -135,6 +135,15 @@
|
||||||
<groupId>com.github.loki4j</groupId>
|
<groupId>com.github.loki4j</groupId>
|
||||||
<artifactId>loki-logback-appender</artifactId>
|
<artifactId>loki-logback-appender</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.redisson</groupId>
|
||||||
|
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||||
|
<version>3.50.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
||||||
|
|
@ -28,3 +28,9 @@ spring:
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
root: info
|
root: info
|
||||||
|
management:
|
||||||
|
endpoints:
|
||||||
|
web:
|
||||||
|
exposure:
|
||||||
|
include: '*'
|
||||||
|
enabled-by-default: on
|
||||||
|
|
@ -32,12 +32,19 @@ public class TraceFilter extends OncePerRequestFilter {
|
||||||
|
|
||||||
private static final String TRACE_ID_HEADER = "X-Trace-Id";
|
private static final String TRACE_ID_HEADER = "X-Trace-Id";
|
||||||
|
|
||||||
|
private static final List<String> URL_EXCLUDE_TEXTS = List.of("actuator");
|
||||||
|
|
||||||
// 需要跳过的二进制内容类型
|
// 需要跳过的二进制内容类型
|
||||||
private static final List<String> BINARY_CONTENT_TYPES = Arrays.asList("image", "video", "audio", "stream", "pdf", "zip", "excel");
|
private static final List<String> BINARY_CONTENT_TYPES = Arrays.asList("image", "video", "audio", "stream", "pdf", "zip", "excel");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
|
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
|
if (URL_EXCLUDE_TEXTS.stream().anyMatch(text -> request.getRequestURI().contains(text))) {
|
||||||
|
filterChain.doFilter(request, response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ContentCachingRequestWrapper requestWrapper = new ContentCachingRequestWrapper(request);
|
ContentCachingRequestWrapper requestWrapper = new ContentCachingRequestWrapper(request);
|
||||||
ContentCachingResponseWrapper responseWrapper = new ContentCachingResponseWrapper(response);
|
ContentCachingResponseWrapper responseWrapper = new ContentCachingResponseWrapper(response);
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue