Caideyipi commented on code in PR #15807:
URL: https://github.com/apache/iotdb/pull/15807#discussion_r4376807047
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/metric/receiver/PipeDataNodeReceiverMetrics.java:
##########
@@ -472,6 +757,148 @@ private void unbind(final AbstractMetricService
metricService) {
RECEIVER,
Tag.TYPE.toString(),
"transferSlice");
+
+ // Rate
+ metricService.remove(
+ MetricType.RATE,
+ Metric.PIPE_DATANODE_RECEIVER_REQ_SIZE.toString(),
+ Tag.NAME.toString(),
+ RECEIVER,
+ Tag.TYPE.toString(),
+ "handshakeDatanodeV1");
Review Comment:
[P2] Remove the same handshake tags that bindTo() registers. The rates are
created with handshakeDataNodeV1/handshakeDataNodeV2, but removal uses
handshakeDatanodeV1/handshakeDatanodeV2. Metric labels are case-sensitive, so
both registered rates survive unbinding and retain their previous counts on
rebinding. Use the registered spelling for both removals and cover the
bind/unbind lifecycle.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java:
##########
@@ -247,8 +248,8 @@ public synchronized TPipeTransferResp receive(final
TPipeTransferReq req) {
PipeTransferDataNodeHandshakeV1Req.fromTPipeTransferReq(req)),
req);
} finally {
- PipeDataNodeReceiverMetrics.getInstance()
- .recordHandshakeDatanodeV1Timer(System.nanoTime() -
startTime);
+ metrics.recordHandshakeDatanodeV1Timer(System.nanoTime() -
startTime);
+ metrics.markHandshakeDatanodeV1Size(req.body.limit());
Review Comment:
[P2] Snapshot the readable body size before dispatch. A request body can be
a ByteBuffer with a nonzero position (for example, a binary field backed by a
Thrift transport buffer). limit() includes the bytes before that position, so
these rates overcount request bytes. Reading the buffer after the handler also
makes the result depend on parsing or getBody() normalizing it. Capture body ==
null ? 0 : body.remaining() once before parsing and use that value in every
finally block in both receivers.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]