Comments (6)
@sandra-markerud For your use case you need to add the change below to your de.markerud.upgrade.configuration.TracingChannelDuplexHandler
@Override
public void flush(ChannelHandlerContext ctx) {
try (Scope scope = contextSnapshotFactory.setThreadLocalsFrom(ctx.channel())) {
ctx.flush();
}
}
from reactor-netty.
@sandra-markerud Can you try the code below?
class TracingChannelDuplexHandler extends ChannelDuplexHandler {
private final ContextSnapshotFactory contextSnapshotFactory;
public TracingChannelDuplexHandler(ContextSnapshotFactory contextSnapshotFactory) {
this.contextSnapshotFactory = contextSnapshotFactory;
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
try (Scope scope = contextSnapshotFactory.setThreadLocalsFrom(ctx.channel())) {
ctx.fireChannelRead(msg);
}
}
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
try (Scope scope = contextSnapshotFactory.setThreadLocalsFrom(ctx.channel())) {
ctx.write(msg, promise);
}
}
@Override
public void flush(ChannelHandlerContext ctx) {
try (Scope scope = contextSnapshotFactory.setThreadLocalsFrom(ctx.channel())) {
ctx.flush();
}
}
}
from reactor-netty.
@violetagg You're right of course. My bad!
Thank you a lot for your quick response.
from reactor-netty.
@violetagg Thank you so much!
I can confirm, that the access-log now shows the tracing context.
I have one more question though:
The TracingChannelDuplexHandler is always coupled with Logbook.
How could I separate this?
Say, I always want the tracing-context logged in the access-log, but I need to be able to disable logbook.
from reactor-netty.
@violetagg this would still work for the access-log. Yes.
But now the logbook logs would not be written.
I need to instrument the TracingChannelDuplexHandler either with or without logbook, depending on if logbook is enabled or not
from reactor-netty.
@sandra-markerud I don't understand ... you can use different ChannelDuplexHandler implementations depending on whether you want to use logbook or not.
from reactor-netty.
Related Issues (20)
- Cookie handling does not conform to RFC 6265 when sending multiple cookies
- CI: Add GitHub Actions to Auto-Format Java Files according to Checkstyle configuration HOT 2
- Connection prematurely closed BEFORE response on half closed connection HOT 19
- reactor netty (1.0.33) not able to decode the packet with PRI* method [PRI* HTTP/2.0] in HTTPS connection HOT 8
- Cannot cast java AtomicLong exception and custom Concurrent connections is leaky over time and HOT 11
- org.springframework.web.reactive.function.client.WebClientRequestException: Connection prematurely closed BEFORE response HOT 2
- HTTP client unable to specify which IP to bind to, what should I do? HOT 8
- HttpServer Underlying Downstream HttpClient Connection Getting Closed Quietly HOT 5
- Spring gateway use reactor netty switch thread spend too many time HOT 7
- TlsMetricsHandler throws NPE when used together with SniHandler HOT 2
- How to chain multiple send and receive operations with reactor-netty TcpClient HOT 1
- LEAK: ByteBuf.release() was not called before it's garbage-collected. HOT 4
- How to implement CORS in Reactor Netty? HOT 1
- Unable to add cookie in redirectRequestBiConsumer HOT 1
- Unable to configure Websocket compression when both HttpProtocol.H2C and HttpProtocol.HTTP1.1 are configured HOT 2
- Is it possible to be able to add custom labels to the metrics already being emitted HOT 2
- Regression from SpringBoot 3.2.2 Factory method 'webClientHttpConnector' threw exception with message: Cannot reserve 49152 bytes of direct buffer memory (allocated: 10452747, limit: 10485760) HOT 8
- out of memory when prometheus is enabled and url with path varaible HOT 5
- Error decoding client data HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactor-netty.