Copilot commented on code in PR #13625:
URL: https://github.com/apache/skywalking/pull/13625#discussion_r2626848022
##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/meter/function/avg/AvgLabeledFunction.java:
##########
@@ -145,6 +161,30 @@ public void deserialize(final RemoteData remoteData) {
this.entityId = remoteData.getDataStrings(0);
this.serviceId = remoteData.getDataStrings(1);
+
Review Comment:
Extra blank line found. This should be a single blank line for consistency
with other labeled function implementations.
```suggestion
```
##########
oap-server/server-core/src/test/java/org/apache/skywalking/oap/server/core/analysis/meter/function/sumpermin/SumPerMinLabeledFunctionTest.java:
##########
@@ -92,9 +92,13 @@ public void testCalculate() {
@Test
public void testHour() {
+ MeterEntity meterEntity1 = MeterEntity.newService("sum_sync_time",
Layer.GENERAL);
+ meterEntity1.setAttr0("testAttr");
+ function.accept(meterEntity1, table1);
+ MeterEntity meterEntity2 = MeterEntity.newService("sum_sync_time",
Layer.GENERAL);
+ meterEntity2.setAttr0("testAttr");
+ function.accept(meterEntity2, table2);
function.setTimeBucket(TimeBucket.getMinuteTimeBucket(System.currentTimeMillis()));
Review Comment:
The order of operations is incorrect. The setTimeBucket should be called
before the accept methods, not after them. This is inconsistent with the other
test methods in this file and could lead to unexpected behavior. The time
bucket should be set on the function before accepting meter entities.
```suggestion
function.setTimeBucket(TimeBucket.getMinuteTimeBucket(System.currentTimeMillis()));
function.accept(meterEntity1, table1);
MeterEntity meterEntity2 = MeterEntity.newService("sum_sync_time",
Layer.GENERAL);
meterEntity2.setAttr0("testAttr");
function.accept(meterEntity2, table2);
```
--
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]