# How to aggregate trace samples by specific span？

**URL:** <https://discuss.elastic.co/t/how-to-aggregate-trace-samples-by-specific-span/360142>\
**Category:** APM\
**Tags:** ui\
**Created:** [May 24, 2024, 9:29am UTC](https://discuss.elastic.co/t/how-to-aggregate-trace-samples-by-specific-span/360142 "2024-05-24T09:29:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chen\_Jiang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chen_jiang/32/125037_2.png) [@Chen\_Jiang](https://discuss.elastic.co/u/Chen_Jiang)\
**Post date:** [May 24, 2024, 9:29am UTC](https://discuss.elastic.co/t/how-to-aggregate-trace-samples-by-specific-span/360142/1 "2024-05-24T09:29:43Z")

</div>

Hi, everyone.  
I have this scenario，I already have 1000 request trace samples, and each sample is made up of several steps, like this:  
request sample：  
step 1: do some redis;  
step 2: call third party service;  
step 3: do some mysql;  
finally: response.

I wanna aggregate the 1000 samples, count the average cost time or percentile of "step 1/2/3", and how it takes up the whole time.  
Where do I go to find the docs？anybody can help？
