jinho-son opened a new issue, #9687: URL: https://github.com/apache/skywalking/issues/9687
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no similar issues. ### Apache SkyWalking Component OAP server (apache/skywalking) ### What happened Using AvgLabeled or Other Labeled, Histogram combined Function, it working like duplicate combined when downsampling HOUR and DAY operation ### What you expected to happen Only working once combine in same timeBucket ### How to reproduce The environment occur using enable downsampling HOUR and DAY application.yaml - core.default.downsampling (HOUR, DAY) 1. The bug occurs in MergableBufferedData accept() 2. If buffer has same METRICS (for example, AvgLabeled, SumHistogram, (using dataTable object or else), etc), but different timeBucket 3. When accept method run combined [code](https://github.com/apache/skywalking/blob/master/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/data/MergableBufferedData.java#L54) 4. It combined looks like duplicate (same metrics but other timebucket) Detail 1. MetricsTransWorker create [toHour](https://github.com/apache/skywalking/blob/master/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsTransWorker.java#L51) and [toDay](https://github.com/apache/skywalking/blob/master/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsTransWorker.java#L53) 2. it create new Metrics object but share same object (such as [object)](https://github.com/apache/skywalking/blob/master/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/meter/function/avg/AvgLabeledFunction.java#L115) 3. run [produce](https://github.com/apache/skywalking/blob/master/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsPersistentWorker.java#L158) and [consume](https://github.com/apache/skywalking/blob/master/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsPersistentWorker.java#L332) 4. If buffer already existed METRICS then [combined](https://github.com/apache/skywalking/blob/master/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/data/MergableBufferedData.java#L54) 5. then toHour METRICS run combined, toDay METRICS run combined for same DataTable It working fine in primitive [value](https://github.com/apache/skywalking/blob/master/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/meter/function/avg/AvgFunction.java) solve: 1. target [toHour](https://github.com/apache/skywalking/blob/master/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/meter/function/avg/AvgLabeledFunction.java#L115) [toDay](https://github.com/apache/skywalking/blob/master/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/meter/function/avg/AvgLabeledFunction.java#L121) 7. change set(DataTable) shallow copy to deep copy (It reference same DataTable) ### Anything else When combined toHour metrics and toDay metrics ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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]
