-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
:logging Extracting request_query_string to a separate MDC field
- Loading branch information
Showing
9 changed files
with
70 additions
and
40 deletions.
There are no files selected for viewing
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
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
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
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
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
34 changes: 34 additions & 0 deletions
34
...src/main/java/dev/iakunin/library/logging/reactive/handler/RequestQueryStringHandler.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,34 @@ | ||
package dev.iakunin.library.logging.reactive.handler; | ||
|
||
import dev.iakunin.library.logging.common.service.FieldTrimmer; | ||
import dev.iakunin.library.logging.reactive.wrapper.ContextWrapper; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.server.reactive.HttpHandler; | ||
import org.springframework.http.server.reactive.ServerHttpRequest; | ||
import org.springframework.http.server.reactive.ServerHttpResponse; | ||
import reactor.core.publisher.Mono; | ||
|
||
@Slf4j | ||
@RequiredArgsConstructor | ||
public final class RequestQueryStringHandler implements HttpHandler { | ||
|
||
private final HttpHandler decorated; | ||
private final FieldTrimmer fieldTrimmer; | ||
private final ContextWrapper contextWrapper; | ||
|
||
@Override | ||
public Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response) { | ||
return decorated.handle(request, response) | ||
.contextWrite( | ||
context -> contextWrapper | ||
.putRequestQueryString( | ||
context, | ||
fieldTrimmer.trim( | ||
request.getURI().getQuery() | ||
) | ||
) | ||
); | ||
} | ||
|
||
} |
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
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
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