VMware Modern Apps Community
thberry10
VMware Employee
VMware Employee
Jump to solution

comparing two time series

If I want to get the ratio between two time series to compute a success or error percent (e.g. compute an AWS ELB 5xx vs. 2xx ratio), is that an expected use case? I think I would have expected a function to do that to keep the syntax concise and to avoid having to manually handle divide by zero, so just want to make sure I'm going down the right path.

e.g. so something like this would be expected in these cases?

ts("myapp.error")/ts("myapp.success")

thanks!

0 Kudos
1 Solution

Accepted Solutions
thberry10
VMware Employee
VMware Employee
Jump to solution

Hi cove@accelbyte.net,

A fairly common pattern in these cases would be to divide the number of errors by the total number of requests - in this case your ratio is more accurate and you don't have to worry about division by zero:

ts("myapp.httpstatus.5*") / sum(ts("myapp.httpstatus.*"))

If your metrics are cumulative counters, a rate() function can be used to calculate the rate of change:

rate(ts("myapp.httpstatus.5*")) / sum(rate(ts("myapp.httpstatus.*")))

Please let us know if this helps!

-Vasily

View solution in original post

0 Kudos
2 Replies
thberry10
VMware Employee
VMware Employee
Jump to solution

Hi cove@accelbyte.net,

A fairly common pattern in these cases would be to divide the number of errors by the total number of requests - in this case your ratio is more accurate and you don't have to worry about division by zero:

ts("myapp.httpstatus.5*") / sum(ts("myapp.httpstatus.*"))

If your metrics are cumulative counters, a rate() function can be used to calculate the rate of change:

rate(ts("myapp.httpstatus.5*")) / sum(rate(ts("myapp.httpstatus.*")))

Please let us know if this helps!

-Vasily

0 Kudos
thberry10
VMware Employee
VMware Employee
Jump to solution

perfect, thanks!

0 Kudos