From fc5f491f14431596aafd52cf2be4c046b93cef13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=84=E6=B4=A5=E6=B4=A5?= Date: Wed, 23 Oct 2019 16:57:37 +0800 Subject: [PATCH] add MonitorBytesHandler, MonitorQpsHandler, JVMGCMetrics, Update MetricsCollector --- .../api/exchange/handler/ChannelHandler.java | 2 - .../common/route/CacheRouteLocator.java | 3 + .../nacos/NacosDynamicConfiguration.java | 1 + piccolo-core/pom.xml | 4 ++ .../core/handler/MonitorBytesHandler.java | 63 +++++++++++++++++++ .../core/handler/MonitorQpsHandler.java | 47 ++++++++++++++ .../piccolo/core/server/ConnectServer.java | 9 +++ .../piccolo/core/server/GatewayServer.java | 10 +++ .../piccolo/core/server/WebSocketServer.java | 8 +++ .../ukuz/piccolo/monitor/JVMGCMetrics.java | 63 +++++++++++++++++++ .../ukuz/piccolo/monitor/MetricsMonitor.java | 34 ++++++++-- .../ukuz/piccolo/monitor/MonitorService.java | 1 + .../monitor/data/MetricsCollector.java | 20 ++++++ .../piccolo/monitor/quota/impl/JVMGC.java | 7 --- piccolo-transport/pom.xml | 8 +-- .../transport/codec/MessageToPacketCodec.java | 4 -- 16 files changed, 262 insertions(+), 22 deletions(-) create mode 100644 piccolo-core/src/main/java/io/github/ukuz/piccolo/core/handler/MonitorBytesHandler.java create mode 100644 piccolo-core/src/main/java/io/github/ukuz/piccolo/core/handler/MonitorQpsHandler.java create mode 100644 piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/JVMGCMetrics.java diff --git a/piccolo-api/src/main/java/io/github/ukuz/piccolo/api/exchange/handler/ChannelHandler.java b/piccolo-api/src/main/java/io/github/ukuz/piccolo/api/exchange/handler/ChannelHandler.java index 3c9bf6c..c7457c9 100644 --- a/piccolo-api/src/main/java/io/github/ukuz/piccolo/api/exchange/handler/ChannelHandler.java +++ b/piccolo-api/src/main/java/io/github/ukuz/piccolo/api/exchange/handler/ChannelHandler.java @@ -15,10 +15,8 @@ */ package io.github.ukuz.piccolo.api.exchange.handler; -import io.github.ukuz.piccolo.api.PiccoloContext; import io.github.ukuz.piccolo.api.connection.Connection; import io.github.ukuz.piccolo.api.exchange.ExchangeException; -import io.netty.channel.Channel; /** * @author ukuz90 diff --git a/piccolo-common/src/main/java/io/github/ukuz/piccolo/common/route/CacheRouteLocator.java b/piccolo-common/src/main/java/io/github/ukuz/piccolo/common/route/CacheRouteLocator.java index bc0704e..64f8ae2 100644 --- a/piccolo-common/src/main/java/io/github/ukuz/piccolo/common/route/CacheRouteLocator.java +++ b/piccolo-common/src/main/java/io/github/ukuz/piccolo/common/route/CacheRouteLocator.java @@ -50,6 +50,8 @@ public void init(PiccoloContext context) throws ServiceException { Map data = Jsons.fromJson(contentInfo, Map.class); cacheRouteMap.putAll(data); } + //register listener + this.configuration.addListener(key, this); } @Override @@ -77,6 +79,7 @@ public void onConfigurationChanged(ConfigurationChangedEvent event) { cacheRouteMap.clear(); } else { Map data = Jsons.fromJson(event.getValue(), Map.class); + cacheRouteMap.clear(); cacheRouteMap.putAll(data); } } diff --git a/piccolo-configcenter/src/main/java/io/github/ukuz/piccolo/configcenter/nacos/NacosDynamicConfiguration.java b/piccolo-configcenter/src/main/java/io/github/ukuz/piccolo/configcenter/nacos/NacosDynamicConfiguration.java index d3b4059..0858e60 100644 --- a/piccolo-configcenter/src/main/java/io/github/ukuz/piccolo/configcenter/nacos/NacosDynamicConfiguration.java +++ b/piccolo-configcenter/src/main/java/io/github/ukuz/piccolo/configcenter/nacos/NacosDynamicConfiguration.java @@ -126,6 +126,7 @@ public Executor getExecutor() { @Override public void innerReceive(String dataId, String group, String configInfo) { + LOGGER.info("innerReceive data: {}, group: {}, configInfo: {}", dataId, group, configInfo); String oldData = cachedData.get(dataId); ConfigurationChangedEvent event = new ConfigurationChangedEvent(dataId, configInfo, getChangeType(oldData, configInfo)); if (configInfo != null) { diff --git a/piccolo-core/pom.xml b/piccolo-core/pom.xml index bb70110..4f658b9 100644 --- a/piccolo-core/pom.xml +++ b/piccolo-core/pom.xml @@ -36,6 +36,10 @@ ${project.groupId} piccolo-mq + + ${project.groupId} + piccolo-monitor + org.apache.curator curator-recipes diff --git a/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/handler/MonitorBytesHandler.java b/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/handler/MonitorBytesHandler.java new file mode 100644 index 0000000..9895e41 --- /dev/null +++ b/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/handler/MonitorBytesHandler.java @@ -0,0 +1,63 @@ +/* + * Copyright 2019 ukuz90 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.github.ukuz.piccolo.core.handler; + +import io.github.ukuz.piccolo.monitor.MetricsMonitor; +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelDuplexHandler; +import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelPromise; +import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame; +import io.netty.handler.codec.http.websocketx.TextWebSocketFrame; + +/** + * @author ukuz90 + */ +@ChannelHandler.Sharable +public class MonitorBytesHandler extends ChannelDuplexHandler { + + private final String serverName; + + public MonitorBytesHandler(String serverName) { + this.serverName = serverName; + } + + @Override + public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { + if (msg instanceof ByteBuf) { + MetricsMonitor.getQuestBytes(serverName).increment(((ByteBuf) msg).readableBytes()); + } else if (msg instanceof BinaryWebSocketFrame) { + MetricsMonitor.getQuestBytes(serverName).increment(((BinaryWebSocketFrame)msg).content().readableBytes()); + } else if (msg instanceof TextWebSocketFrame) { + MetricsMonitor.getQuestBytes(serverName).increment(((TextWebSocketFrame)msg).content().readableBytes()); + } + super.channelRead(ctx, msg); + } + + @Override + public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { + if (msg instanceof ByteBuf) { + MetricsMonitor.getResponseBytes(serverName).increment(((ByteBuf) msg).readableBytes()); + } else if (msg instanceof BinaryWebSocketFrame) { + MetricsMonitor.getResponseBytes(serverName).increment(((BinaryWebSocketFrame)msg).content().readableBytes()); + } else if (msg instanceof TextWebSocketFrame) { + MetricsMonitor.getResponseBytes(serverName).increment(((TextWebSocketFrame)msg).content().readableBytes()); + } + super.write(ctx, msg, promise); + } + +} diff --git a/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/handler/MonitorQpsHandler.java b/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/handler/MonitorQpsHandler.java new file mode 100644 index 0000000..68b70f2 --- /dev/null +++ b/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/handler/MonitorQpsHandler.java @@ -0,0 +1,47 @@ +/* + * Copyright 2019 ukuz90 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.github.ukuz.piccolo.core.handler; + +import io.github.ukuz.piccolo.monitor.MetricsMonitor; +import io.netty.channel.ChannelDuplexHandler; +import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelPromise; + +/** + * @author ukuz90 + */ +@ChannelHandler.Sharable +public class MonitorQpsHandler extends ChannelDuplexHandler { + + private final String serverName; + + public MonitorQpsHandler(String serverName) { + this.serverName = serverName; + } + + @Override + public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { + MetricsMonitor.getQuestCount(serverName).increment(); + super.channelRead(ctx, msg); + } + + @Override + public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { + MetricsMonitor.getResponseCount(serverName).increment(); + super.write(ctx, msg, promise); + } +} diff --git a/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/server/ConnectServer.java b/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/server/ConnectServer.java index a68e745..f8ed755 100644 --- a/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/server/ConnectServer.java +++ b/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/server/ConnectServer.java @@ -29,6 +29,8 @@ import io.github.ukuz.piccolo.common.thread.NamedThreadFactory; import io.github.ukuz.piccolo.common.thread.ThreadNames; import io.github.ukuz.piccolo.core.handler.ChannelHandlers; +import io.github.ukuz.piccolo.core.handler.MonitorBytesHandler; +import io.github.ukuz.piccolo.core.handler.MonitorQpsHandler; import io.github.ukuz.piccolo.core.properties.ThreadProperties; import io.github.ukuz.piccolo.monitor.MonitorExecutorFactory; import io.github.ukuz.piccolo.transport.codec.Codec; @@ -52,6 +54,8 @@ public class ConnectServer extends NettyServer { private InetSocketAddress address; private GlobalChannelTrafficShapingHandler channelTrafficShapingHandler; + private MonitorBytesHandler monitorBytesHandler; + private MonitorQpsHandler monitorQpsHandler; private DefaultServiceInstance serviceInstance; public ConnectServer(PiccoloContext piccoloContext) { @@ -87,6 +91,9 @@ protected void doInit() { traffic.getWriteGlobalLimit(), traffic.getReadGlobalLimit(), traffic.getWriteChannelLimit(), traffic.getReadChannelLimit()); } + + monitorBytesHandler = new MonitorBytesHandler(getName()); + monitorQpsHandler = new MonitorQpsHandler(getName()); } @Override @@ -131,6 +138,8 @@ protected void initPipeline(ChannelPipeline pipeline) { if (channelTrafficShapingHandler != null) { pipeline.addFirst(channelTrafficShapingHandler); } + pipeline.addBefore("decoder", "monitor_bytes", monitorBytesHandler); + pipeline.addAfter("decoder", "monitor_qps", monitorQpsHandler); } @Override diff --git a/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/server/GatewayServer.java b/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/server/GatewayServer.java index b818dd1..3a50779 100644 --- a/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/server/GatewayServer.java +++ b/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/server/GatewayServer.java @@ -29,6 +29,8 @@ import io.github.ukuz.piccolo.common.thread.NamedThreadFactory; import io.github.ukuz.piccolo.common.thread.ThreadNames; import io.github.ukuz.piccolo.core.handler.ChannelHandlers; +import io.github.ukuz.piccolo.core.handler.MonitorBytesHandler; +import io.github.ukuz.piccolo.core.handler.MonitorQpsHandler; import io.github.ukuz.piccolo.core.properties.ThreadProperties; import io.github.ukuz.piccolo.monitor.MonitorExecutorFactory; import io.github.ukuz.piccolo.transport.codec.Codec; @@ -54,6 +56,8 @@ public class GatewayServer extends NettyServer { private final ConnectionManager cxnxManager; private DefaultServiceInstance serviceInstance; private GlobalChannelTrafficShapingHandler trafficShapingHandler; + private MonitorBytesHandler monitorBytesHandler; + private MonitorQpsHandler monitorQpsHandler; public GatewayServer(PiccoloContext piccoloContext) { this(piccoloContext, @@ -88,6 +92,9 @@ protected void doInit() { traffic.getWriteGlobalLimit(), traffic.getReadGlobalLimit(), traffic.getWriteChannelLimit(), traffic.getReadChannelLimit()); } + + monitorBytesHandler = new MonitorBytesHandler(getName()); + monitorQpsHandler = new MonitorQpsHandler(getName()); } @Override @@ -125,6 +132,9 @@ protected void initPipeline(ChannelPipeline pipeline) { if (trafficShapingHandler != null) { pipeline.addFirst(trafficShapingHandler); } + + pipeline.addBefore("decoder", "monitor_bytes", monitorBytesHandler); + pipeline.addAfter("decoder","monitor_qps", monitorQpsHandler); } @Override diff --git a/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/server/WebSocketServer.java b/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/server/WebSocketServer.java index 1de119d..f353249 100644 --- a/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/server/WebSocketServer.java +++ b/piccolo-core/src/main/java/io/github/ukuz/piccolo/core/server/WebSocketServer.java @@ -30,6 +30,8 @@ import io.github.ukuz.piccolo.common.thread.ThreadNames; import io.github.ukuz.piccolo.core.externel.handler.WebSocketIndexHandler; import io.github.ukuz.piccolo.core.handler.ChannelHandlers; +import io.github.ukuz.piccolo.core.handler.MonitorBytesHandler; +import io.github.ukuz.piccolo.core.handler.MonitorQpsHandler; import io.github.ukuz.piccolo.core.properties.ThreadProperties; import io.github.ukuz.piccolo.monitor.MonitorExecutorFactory; import io.github.ukuz.piccolo.transport.codec.*; @@ -53,6 +55,8 @@ public class WebSocketServer extends NettyServer { private InetSocketAddress address; private DefaultServiceInstance serviceInstance; + private MonitorBytesHandler monitorBytesHandler; + private MonitorQpsHandler monitorQpsHandler; public WebSocketServer(PiccoloContext piccoloContext) { this(piccoloContext, ChannelHandlers.newConnectChannelHandler(piccoloContext), new NettyConnectionManager()); @@ -77,6 +81,8 @@ protected Codec newCodec() { @Override protected void doInit() { + monitorBytesHandler = new MonitorBytesHandler(getName()); + monitorQpsHandler = new MonitorQpsHandler(getName()); } @Override @@ -111,8 +117,10 @@ protected void initPipeline(ChannelPipeline pipeline) { pipeline.addLast(new WebSocketServerProtocolHandler(piccoloContext.getProperties(NetProperties.class).getWsPath(), null, true)); //inbound pipeline.addLast(new WebSocketIndexHandler()); + pipeline.addLast(monitorBytesHandler); pipeline.addLast(codec.getDecoder()); pipeline.addLast(codec.getEncoder()); + pipeline.addLast(monitorQpsHandler); //duplex pipeline.addLast(getServerHandler()); } diff --git a/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/JVMGCMetrics.java b/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/JVMGCMetrics.java new file mode 100644 index 0000000..41c1025 --- /dev/null +++ b/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/JVMGCMetrics.java @@ -0,0 +1,63 @@ +/* + * Copyright 2019 ukuz90 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.github.ukuz.piccolo.monitor; + +import io.github.ukuz.piccolo.monitor.quota.GCQuota; +import io.micrometer.core.instrument.Gauge; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.binder.MeterBinder; + +/** + * @author ukuz90 + */ +public class JVMGCMetrics implements MeterBinder { + + private final GCQuota gcQuota; + + private static final String COUNT = "count"; + private static final String TIME = "time"; + + public JVMGCMetrics(GCQuota gcQuota) { + this.gcQuota = gcQuota; + } + + @Override + public void bindTo(MeterRegistry registry) { + Gauge.builder("jvm.gc.collection.count", gcQuota, GCQuota::youngGcCollectionCount) + .description("") + .baseUnit(COUNT) + .tag("name", "young gc") + .register(registry); + + Gauge.builder("jvm.gc.collection.count", gcQuota, GCQuota::fullGcCollectionCount) + .description("") + .baseUnit(COUNT) + .tag("name", "full gc") + .register(registry); + + Gauge.builder("jvm.gc.collection.time", gcQuota, GCQuota::youngGcCollectionTime) + .description("") + .baseUnit(TIME) + .tag("name", "young gc") + .register(registry); + + Gauge.builder("jvm.gc.collection.time", gcQuota, GCQuota::fullGcCollectionTime) + .description("") + .baseUnit(TIME) + .tag("name", "full gc") + .register(registry); + } +} diff --git a/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/MetricsMonitor.java b/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/MetricsMonitor.java index 8923af5..6012665 100644 --- a/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/MetricsMonitor.java +++ b/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/MetricsMonitor.java @@ -17,6 +17,7 @@ import io.github.ukuz.piccolo.api.common.utils.StringUtils; import io.github.ukuz.piccolo.api.external.common.Assert; +import io.github.ukuz.piccolo.monitor.quota.GCQuota; import io.micrometer.core.instrument.*; import io.micrometer.core.instrument.binder.jvm.DiskSpaceMetrics; import io.netty.util.internal.PlatformDependent; @@ -31,7 +32,10 @@ */ public class MetricsMonitor { - private static final String MONITOR_TAG = "piccolo_app_monitor"; + private static final String REQUEST_CNT_TAG = "piccolo_recv_count"; + private static final String REQUEST_BYTES_TAG = "piccolo_recv_bytes"; + private static final String RESPONSE_CNT_TAG = "piccolo_send_count"; + private static final String RESPONSE_BYTES_TAG = "piccolo_send_bytes"; public static void gauge(String tag, String module, String name, Number value) { if (StringUtils.hasText(module)) { @@ -70,12 +74,28 @@ private static List wrapLabelSet(String ...label) { return labelSet; } - public static final Counter getWebSocketQuestCount() { - return counter(MONITOR_TAG, "module", "net", "name", "websocketQuestCount"); +// public static final Counter getWebSocketQuestCount() { +// return counter(MONITOR_TAG, "module", "net", "name", "websocketQuestCount"); +// } +// +// public static final Counter getWebSocketBytesCount() { +// return counter(MONITOR_TAG, "module", "net", "name", "websocketBytesCount"); +// } + + public static final Counter getQuestCount(String name) { + return counter(REQUEST_CNT_TAG, "name", name); + } + + public static final Counter getQuestBytes(String name) { + return counter(REQUEST_BYTES_TAG, "name", name); } - public static final Counter getWebSocketBytesCount() { - return counter(MONITOR_TAG, "module", "net", "name", "websocketBytesCount"); + public static final Counter getResponseCount(String name) { + return counter(RESPONSE_CNT_TAG, "name", name); + } + + public static final Counter getResponseBytes(String name) { + return counter(RESPONSE_BYTES_TAG, "name", name); } public static final void monitorDisk() { @@ -84,4 +104,8 @@ public static final void monitorDisk() { } } + public static final void monitorGC(GCQuota gcQuota) { + new JVMGCMetrics(gcQuota).bindTo(Metrics.globalRegistry); + } + } diff --git a/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/MonitorService.java b/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/MonitorService.java index 219c70d..557d9db 100644 --- a/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/MonitorService.java +++ b/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/MonitorService.java @@ -58,6 +58,7 @@ public void init(PiccoloContext context) throws ServiceException { private void bind(PiccoloContext context) { MetricsMonitor.monitorDisk(); + MetricsMonitor.monitorGC(metricsCollector.getQuota()); } @Override diff --git a/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/data/MetricsCollector.java b/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/data/MetricsCollector.java index 0cdb8cd..ec066c5 100644 --- a/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/data/MetricsCollector.java +++ b/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/data/MetricsCollector.java @@ -47,4 +47,24 @@ public MetricsResult monitor() { .result("piccolo_info", infoQuota.monitor()) ; } + + public GCQuota getQuota() { + return quota; + } + + public ThreadPoolQuota getThreadPoolQuota() { + return threadPoolQuota; + } + + public MemoryQuota getMemoryQuota() { + return memoryQuota; + } + + public ThreadQuota getThreadQuota() { + return threadQuota; + } + + public InfoQuota getInfoQuota() { + return infoQuota; + } } diff --git a/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/quota/impl/JVMGC.java b/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/quota/impl/JVMGC.java index 64af35b..ba77895 100644 --- a/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/quota/impl/JVMGC.java +++ b/piccolo-monitor/src/main/java/io/github/ukuz/piccolo/monitor/quota/impl/JVMGC.java @@ -152,11 +152,4 @@ public Object monitor(Object... args) { return result; } - public static void main(String[] args) throws InterruptedException { - JVMGC gc = new JVMGC(); - while (true) { - System.out.println(gc.monitor()); - Thread.sleep(3000); - } - } } diff --git a/piccolo-transport/pom.xml b/piccolo-transport/pom.xml index e003f6c..a9a2876 100644 --- a/piccolo-transport/pom.xml +++ b/piccolo-transport/pom.xml @@ -24,10 +24,10 @@ ${project.groupId} piccolo-common - - ${project.groupId} - piccolo-monitor - + + + + io.netty netty-transport diff --git a/piccolo-transport/src/main/java/io/github/ukuz/piccolo/transport/codec/MessageToPacketCodec.java b/piccolo-transport/src/main/java/io/github/ukuz/piccolo/transport/codec/MessageToPacketCodec.java index ea840cf..f69ed6a 100644 --- a/piccolo-transport/src/main/java/io/github/ukuz/piccolo/transport/codec/MessageToPacketCodec.java +++ b/piccolo-transport/src/main/java/io/github/ukuz/piccolo/transport/codec/MessageToPacketCodec.java @@ -19,7 +19,6 @@ import io.github.ukuz.piccolo.api.exchange.protocol.Packet; import io.github.ukuz.piccolo.api.exchange.support.BaseMessage; import io.github.ukuz.piccolo.api.exchange.support.PacketToMessageConverter; -import io.github.ukuz.piccolo.monitor.MetricsMonitor; import io.netty.buffer.ByteBuf; /** @@ -52,9 +51,6 @@ public void encode(Connection connection, Object msg, ByteBuf out) throws CodecE @Override public Object decode(Connection connection, ByteBuf in) throws CodecException { Packet packet = (Packet) packetCodec.decode(connection, in); - // metrics - MetricsMonitor.getWebSocketBytesCount().increment(Packet.HEADER_LENGTH + packet.getPayload().length); - MetricsMonitor.getWebSocketQuestCount().increment(); if (converter != null) { BaseMessage message = converter.convert(packet, connection);