zhyyu opened a new issue, #9619: URL: https://github.com/apache/skywalking/issues/9619
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When most request response time is less than 10ms (the default oal precision is 10), the percentile p50 will be all 0, like this <img width="443" alt="image" src="https://user-images.githubusercontent.com/22634485/190603970-1a1fe1f0-77ba-410a-abb8-97c960b0b311.png"> , and this is obscure. I read the `PercentileMetrics` code and found the `combine` function ```java public final void combine(@SourceFrom int value, @Arg int precision) { this.isCalculated = false; this.precision = precision; String index = String.valueOf(value / precision); dataset.valueAccumulation(index, 1L); } ``` So the index will be 0 when response time is less than 10(default precision is 10, oal: `service_percentile = from(Service.latency).percentile(10);`) and the index key will be multi by precision when calculate funcition called ```java percentileValues.put(String.valueOf(rankIdx), Long.parseLong(key) * precision); ``` So, the finally P50 will be 0. Can we change the combine function in `PercentileMetrics`, do ceiling operate when calcuate index, so the index will not be 0, like this ```java public final void combine(@SourceFrom int value, @Arg int precision) { this.isCalculated = false; this.precision = precision; String index = String.valueOf(Math.ceil(value * 1.0 / precision)); dataset.valueAccumulation(index, 1L); } ``` So, the P50 will be 10ms, when most response time is less than 10ms and easily to understand P50 that 50% req is less than 10ms. ### Use case like above ### Related issues _No response_ ### Are you willing to submit a PR? - [X] 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]
