Query to calculate wait time between two metrics

Hi,

I am looking for a query to calculate the wait time between two metrics.

Details:

metric1 (component=“xyz”, activityEndTime=“epoch time1”) — created at 10/31/2021 09:47:00 AM
metric1 (component=“abc”, activityEndTime=“epoch time2”) — created at 10/31/2021 09:52:00 AM

Looking for the query either time difference between the metrics (metric1 - metric1) or retrieving activityEndTime and calculate the difference in time (epoch time2 - epoch time1 = 5 mins).

Any help is greatly appreciated.

Thanks,
Vijay

You can use timestamp() or expose the timestamp for those events from the application.

What have you tried yet? Concrete metrics examples might help us to help you.