Working with counters
In IT monitoring, we're heavily working with counters. Linux's data, number of HTTP calls, and so on. With WarpScript, you can easily avoid counter resets and calculate rate.
How to detect counter resets and remove them
The RESETS functions compensates for possible counter resets by adding the last value before the rest to all values after the reset.
You just need to use the RESETS like this:
 FETCH // Fetch your data FALSE RESETS // compensates your counter if it was reset
You can play with these example using Quantum: resets.
How to transform a counter into a rate
The mapper.rate function computes the rate of change between the first and last values (rate = (last - first) / (lastick - firsttick)) of each sliding window. The location and elevation returned are those associated with the most recent value in the sliding window.
Here's an example:
 FETCH // Fetch your data [ SWAP mapper.rate 1 0 0 ] MAP // compute a rate on a sliding-window
You can play with these example using Quantum: rate.
Patterns detection is easy using built-in functions:
- PATTERNS is generating a list of motifs.
- PATTERNDETECTION is running the list of motifs on all the time series you have.
Here's an example:
 FETCH 'gts' STORE  FETCH 'pattern.to.detect' STORE 32 'windowSize' STORE 8 'patternLength' STORE 16 'quantizationScale' STORE $pattern.to.detect 0 GET $windowSize $patternLength $quantizationScale PATTERNS VALUES 'patterns' STORE $gts $patterns $windowSize $patternLength $quantizationScale PATTERNDETECTION
You can play with these example using Quantum: pattern.
Working with annotations
Annotations are a powerful Warp10 features. You can enrich your graph with custom-crafted annotations such as:
- new releases
- bug reporting
To use annotations, you just have to push the value as string into Metrics. Only Warp10 protocol allows to do it. You can also convert a serie into annotations by converting its values into string or boolean.
Here's an example using an outliers functions called ESDTEST:
To easily transform a GTS into an annotation, use mapper.toboolean or use mapper.tostring from the MAP framework.
You can play with these example using Quantum: outliers.