Include message and bytes metrics in the status of the active MQTT connections.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package io.moquette.server.netty.metrics;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelDuplexHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelPromise;
|
||||
@@ -63,4 +64,8 @@ public class BytesMetricsHandler extends ChannelDuplexHandler {
|
||||
m_collector.sumWroteBytes(metrics.wroteBytes());
|
||||
super.close(ctx, promise);
|
||||
}
|
||||
|
||||
public static BytesMetrics getBytesMetrics(Channel channel) {
|
||||
return channel.attr(ATTR_KEY_METRICS).get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package io.moquette.server.netty.metrics;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelDuplexHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelPromise;
|
||||
@@ -62,4 +63,8 @@ public class MessageMetricsHandler extends ChannelDuplexHandler {
|
||||
m_collector.sumWroteMessages(metrics.messagesWrote());
|
||||
super.close(ctx, promise);
|
||||
}
|
||||
|
||||
public static MessageMetrics getMessageMetrics(Channel channel) {
|
||||
return channel.attr(ATTR_KEY_METRICS).get();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user