# Calculating Metrics based on 2 measurements

#1

From my early understanding of Kapactior, we can stream events (measurements) as they happen. Essentially one after another after another. We can write tick scripts to container logic to do stuff as certain events (measurements) occur (If any of this isn’t right please correct me).

What I am interested in is, the ability to say, event A for person 1 occurred, then event B for person 1 occurred. What is the duration between event A and event B for Person 1? Could a Tickscript be used here? Is a user defined function more inline with this? Is is a combination of both?

From our understanding Flux is still in early stages. We want to get this into production as fast as possible. However we are hesitant to deploy nightly builds of the required pieces for this functionality. Is there any existing features we can take advantage of in the current stable version of InfluxDB/Kapacitor? Also, is there an expected timeline for Flux in a stable build?

#2

From my early understanding of Kapactior, we can stream events (measurements) as they happen. Essentially one after another after another. We can write tick scripts to container logic to do stuff as certain events (measurements) occur (If any of this isn’t right please correct me).

The above is correct; when using Kapacitor you can choose to create either a stream task or batch task. Please see this blog for more information on the capabilities of each type.

What I am interested in is, the ability to say, event A for person 1 occurred, then event B for person 1 occurred. What is the duration between event A and event B for Person 1? Could a Tickscript be used here? Is a user defined function more inline with this? Is is a combination of both?

I believe writing a TICKscript should suffice here, but let me double-check on this and get back to you.

From our understanding Flux is still in early stages. We want to get this into production as fast as possible. However we are hesitant to deploy nightly builds of the required pieces for this functionality. Is there any existing features we can take advantage of in the current stable version of InfluxDB/Kapacitor? Also, is there an expected timeline for Flux in a stable build?

Flux is something that we’ve been working on for awhile now, but at the current time, you are correct, we only have the nightly builds available to us. We are definitely working on getting an officially supported/stable version out as soon as possible, hopefully by end of summer.

#3

Sweet! Thank you for the response. I look forward to your response regarding the TICKscript solution.
@mschae16

#4

Hi there, I’ve confirmed with the team that yes, it is possible to perform those operations across multiple measurements using a TICKscript. It is also possible to do the same using Flux, but at the moment it’s still in the nightly build version. However, using InfluxQL (InfluxDB’s query language) it is not possible to perform mathematical operations across multiple measurements. Please refer to this documentation for further reference. Thanks!