Time difference between two metrics with different labels (wait time) using Grafana transformations

Hi,

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

Details:

metric1 (component=“xyz”, activityEndTime=“epoch time1”) — created at 11/01/2021 09:47:00 AM
metric1 (component=“abc”, activityEndTime=“epoch time2”) — created at 11/01/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

Hello :wave: and welcome to the forum, @vijayin26

Can you share a screenshot of your data in a table, or share your raw, unformatted data like this?

I would also try starting a sequence of transformations with the labels to fields transformation: Types and options | Grafana Labs

Hi Matt,

Thank You so much for your response. Unfortunately I can’t share the entire data.

component_timer_seconds_sum{application=“abc”, businessKey=“44033”, activityEndTime=“1635489470672”, componentClass=“xyz1”, status=“start”}
component_timer_seconds_sum{application=“abc”, businessKey=“44033”, activityEndTime=“1635538784375”, componentClass=“xyz2”, status=“end”}

Need to calculate the (1635538784375 - 1635489470672) or the time difference between those two metrics whichever possible.

Thanks,
Vijay