Skip to content

Commit

Permalink
Merge #3231 into 1.2.0-M2
Browse files Browse the repository at this point in the history
  • Loading branch information
violetagg committed May 7, 2024
2 parents 4a14be4 + 022bccf commit b76765d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Expand Up @@ -185,7 +185,7 @@ public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
if (channelOps instanceof HttpServerOperations) {
HttpServerOperations ops = (HttpServerOperations) channelOps;
try {
recordWrite(ops);
recordWrite(ctx.channel());
}
catch (RuntimeException e) {
// Allow request-response exchange to continue, unaffected by metrics problem
Expand Down Expand Up @@ -310,7 +310,7 @@ protected void recordRead() {
recorder().recordDataReceived(remoteSocketAddress, path, dataReceived);
}

protected void recordWrite(HttpServerOperations ops) {
protected void recordWrite(Channel channel) {
Duration dataSentTimeDuration = Duration.ofNanos(System.nanoTime() - dataSentTime);
recorder().recordDataSentTime(path, method, status, dataSentTimeDuration);

Expand Down
Expand Up @@ -15,6 +15,7 @@
*/
package reactor.netty.http.server;

import io.netty.channel.Channel;
import reactor.util.annotation.Nullable;
import reactor.util.context.ContextView;

Expand Down Expand Up @@ -72,7 +73,7 @@ protected void recordRead() {
}

@Override
protected void recordWrite(HttpServerOperations ops) {
protected void recordWrite(Channel channel) {
Duration dataSentTimeDuration = Duration.ofNanos(System.nanoTime() - dataSentTime);
recorder().recordDataSentTime(contextView, path, method, status, dataSentTimeDuration);

Expand Down
Expand Up @@ -19,6 +19,7 @@
import io.micrometer.core.instrument.Timer;
import io.micrometer.observation.Observation;
import io.micrometer.observation.transport.RequestReplyReceiverContext;
import io.netty.channel.Channel;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpResponse;
import reactor.netty.observability.ReactorNettyHandlerContext;
Expand Down Expand Up @@ -85,7 +86,7 @@ protected HttpServerMetricsRecorder recorder() {
}

@Override
protected void recordWrite(HttpServerOperations ops) {
protected void recordWrite(Channel channel) {
Duration dataSentTimeDuration = Duration.ofNanos(System.nanoTime() - dataSentTime);
recorder().recordDataSentTime(path, method, status, dataSentTimeDuration);

Expand All @@ -100,7 +101,7 @@ protected void recordWrite(HttpServerOperations ops) {
// Move the implementation from the recorder here
responseTimeObservation.stop();

setChannelContext(ops.channel(), parentContextView);
setChannelContext(channel, parentContextView);

responseTimeHandlerContext = null;
responseTimeObservation = null;
Expand Down

0 comments on commit b76765d

Please sign in to comment.