Calculations for APM Visualizations

How can I calculate the difference between one span start time and child transaction start time and in another way - child transaction end time substract span end time on any chart

Hi @Christina01 ,

welcome to the Kibana community.
May I ask which version of Kibana do you have and how is your data/documents structured?

1 Like


And how is the data structured for the chart above?

Hi @Christina01 Welcome to the community.

@Marco_Liberati That is the APM Transaction Screen, so that data is per the ECS spec collected by the Elastic APM Agent for APM transactions, traces and spans.

@Christina01 There is no a simple way to do that today other than probably a very custom visualization as far as I know.

Visually you can see the difference ... but it sounds like that is not enough.
Can I ask a bit more than about what you are trying to accomplish?
Are you just trying to display the difference?
Are you trying to Alert off difference?


@stephenb Thank you for reply.
In this way I want to show network processing - max values of difference (marked on my screenshot as 1 and 2). No alerts needed currently

Hi @Christina01

Thanks for the clarification.

So, I still do not think there is an easy way to do this, this being measure network latency with APM data.

Also I am not sure if it is your example but the Green Span does not appear to be Child of the bottom blue span.

But more importantly it may not be just network that is the difference / when a child span starts. Depending on what the application code is doing there could be many reason when the child span starts later, example many methods, calculations the parent etc before the child span starts...

If you are wanting to measure network latency I am not sure this the best method.

You can look at the Time Spent by Span to get a sense where time is being spent. In this can saying that 95% of the time is in the http layer etc.

1 Like

Yes, I need to measure network latency.

In my example green line is a child transaction.

This gets more complicated because its not http - its web socket.

Pls suggest the right way to show cases where network processing is a problem

Note APM tool is not the right tool to measure pure network latency... but I think at some point in the future we may show some metrics on the service map but I an not sure when that will happen.

What it can do is show the overhead of http or websocket

The span type breakdown chart looks at span.type & span.subtype , so span.type would be external and span.subtype would be http , websocket , graphql , etc. and displays the duration sum in that chart.

So websocket should be supported and you should see it in the graph can you see / show that for the websocket service?

If you go into discover and do the same we can see what the values are... if you see this I can show you how to build a graph of those latencies.

Here is an example with http (I do not have a websocket app)


Lens Visualization of HTTP overhead / latency...

Formula to turn into ms

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.