Graphite to CAQL Conversion

Supported Functions

Below you’ll find the Graphite functions that we directly support and their CAQL equivalents.

Graphite Function CAQL Equivalent Notes
absolute(seriesList) math:abs()
add(seriesList, constant) find(...) | each:add(x)
aggregate(seriesList, func, xFilesFactor=None) find(...) | stats:<func>('VIEW_PERIOD')
aggregateWithWildcards(seriesList, func, *positions) find(seriesList) | graphite:removenode(positions) | group_by:<func>('__name')
alias(seriesList, newName) find(...) | label("new_label")
aliasByMetric(seriesList) tag:synth | label
aliasByNode(seriesList, *nodes) find(...) | graphite:aliasbynode(<NODE NUMBER>)
aliasSub(seriesList, search, replace) find(...) | graphite:aliasSub('search', 'replace')
alpha(seriesList, alpha) pass() CAQL is not supporting output picture manipulation
areaBetween(seriesList) pass() CAQL is not supporting output picture manipulation
asPercent(S) graphite:find(S) | stats:ratio(of=100) Returns percentage from a total sum or serie S
asPercent(S, N) graphite:find(S) | each:mul(100) | each:div(N) Returns percentage of serie S from number N
asPercent(S1, S2) op:div2{graphite:find(S1),graphite:find(S2)} | each:mul(100) Returns percentage of series S1 from series S2. Unfortunately, this translation works only with series but not seriesLists, because CAQL has no determined order of series lists, as Graphite has.
asPercent(S1, S2, N) op:div2{graphite:find(S1) | graphite:tagbynode('__gbtag',N),graphite:find(S2) |graphite:tagbynode('__gbtag',N) |group_by:sum('__gbtag')}| each:mul(100) Returns percentage of series S1 from sum of series S2 made by node N (same as sumSeriesWithWildcards(S2, N)). Unfortunately, this translation works only with series but not seriesLists, because CAQL has no determined order of series lists, as Graphite has.
asPercent(S1, None, N) graphite:find(S1) | graphite:tagbynode('__gbtag',N) | stats:ratio(of=100,partition='__gbtag') Return percentage of series or serieslist S1 from sum of itself by node N.
averageAbove(seriesList, n) find(...) | filter:mean:gt(x)
averageBelow(seriesList, n) find(...) | filter:mean:lt(x)
averageSeries(*seriesLists) find(...) | stats:mean
averageSeriesWithWildcards(seriesList, *position) find(seriesList) | graphite:removenode(position) | group_by:mean('__name')
avg(*seriesLists) alias for averageSeries(*seriesLists)
changed(seriesList) find(seriesList) | diff() | math:abs() | op:gt(0)
color(seriesList, theColor) pass() CAQL is not supporting output picture manipulation
consolidateBy(seriesList, consolidationFunc) find(...) | window:<sum|max|min|etc.>([period=VIEW_PERIOD]) last is implemented as first in CAQL
constantLine(value) value
countSeries(*seriesLists) | count()
currentAbove(seriesList, n) graphite:find(seriesList) | filter:latest:gt(n)
currentBelow(seriesList, n) graphite:find(seriesList) | filter:latest:leq(n)
cumulative(seriesList) find(...) | window:sum('VIEW_PERIOD')
dashed(seriesList, dashLength=5) pass() CAQL is not supporting output picture manipulation
delay(seriesList, steps) find(seriesList) | delay(<steps>M) same as timeShift() but supports only datapoints
derivative(seriesList) find(...) | diff()
diffSeries(*seriesLists) find(...) | op:sub() first argument must be a single metric; if the find() gets multiples, then behavior will be wrong
divideSeries(dividendSeriesList, divisorSeries) op:div { find(dividendSeriesList), find(divisorSeries) }
divideSeriesLists(dividendSeriesList, divisorSeriesList) `op:div { find(dividendSeriesList) | vector(), find(divisorSeriesList) | vector()} vector:unpack()`
events(*tags) pass() we do not support the Graphite events API
exclude(seriesList, pattern) exclude:label queries with exclude should be rewritten to not request the things being excluded
exp(seriesList) find(seriesList) | math:exp()
exponentialMovingAverage(seriesList, windowSize) find(seriesList) | forecasting:ewma(0.5) we’re ignoring interval and replacing it with some arbitrary alpha value (0.5)
filterSeries(seriesList, func, operator, threshold) graphite:find('seriesList') | window:func('VIEW_PERIOD') | filter:all:OP(threshold)
grep(seriesList, pattern) find(seriesList) | filter:label:matches(pattern)
group(*seriesLists) pass()
groupByNode(seriesList, nodeNum, callback='average') group_by::<agg>(__tag)
groupByNodes(seriesList, callback, *nodes) group_by::<agg>(__tag)
highestAverage(seriesList, n) | top(1)
highestMax(seriesList, n) | top(1, method="max")
hitcount(seriesList, intervalString, alignToInterval=False) | window:sum(interval) | each:mul(interval)
integral(seriesList) find(...) | integrate
invert(seriesList) op:exp(-1)
isNonNull(seriesList) | count()
keepLastValue(seriesList, limit=inf) find(...) | fill:forward second argument ignored
limit(seriesList, n) filter:limit()
logarithm(seriesList, base=10) find(seriesList) | math:log(base)
lineWidth(seriesList, width) pass() CAQL is not supporting output picture manipulation
maximumAbove(seriesList, n) filter::all:gt
maximumBelow(seriesList, n) filter:all:lt
maxSeries(*seriesLists) find(...) | stats:max()
minimumAbove(seriesList, n) filter:all:gt
minimumBelow(seriesList, n) filter:all:lt
minMax(seriesList) normalize()
minSeries(*seriesLists) find(...) | stats:min()
movingAverage(seriesList, windowSize, xFilesFactor=None) find(...) | rolling:mean(<window_duration>)
movingMax(seriesList, windowSize, xFilesFactor=None) find(...) | rolling:max(<window_dur>)
movingMedian(seriesList, windowSize, xFilesFactor=None) find(...) | rolling:percentile(<window_dur>, 50)
movingMin(seriesList, windowSize, xFilesFactor=None) find(...) | rolling:min(<window_dur>)
movingSum(seriesList, windowSize, xFilesFactor=None) find(...) | rolling:sum(<window_duration>)
movingWindow(seriesList, windowSize, func='average', xFilesFactor=None) find(seriesList) | rolling:<func>(<window_duration>) we’re ignoring xFilesFactor parameter
multiplySeries(*seriesLists) op:prod{ find("metric1"), find("metric2"), find("metricN") }
multiplySeriesWithWildcards(seriesList, *position) find(seriesList) | graphite:removenode(position) | group_by:prod('__name')
nonNegativeDerivative(seriesList, maxValue=None, minValue=None) | counter() | each:mul(60)
offset(seriesList, factor) find(...) | each:add(x)
perSecond(seriesList, maxValue=None, minValue=None) find() | counter()
pieAverage(series) find(...) | stats:mean CAQL not supporting pie graphs, but we’re replacing it with average function
pieMaximum(series) find(...) | stats:max CAQL not supporting pie graphs, but we’re replacing it with max function
pieMinimum(series) find(...) | stats:min CAQL not supporting pie graphs, but we’re replacing it with min function
pow(seriesList, factor) find(...) | each:exp(factor)
powSeries(*seriesLists) find(...) | op:exp()
randomWalkFunction(name, step=60) randomwalk() Name and step parameter are ignored
removeAbovePercentile(seriesList, n) filter:values:percentile:lt
removeAboveValue(seriesList, n) find(...) | filter:all:lt([filter_value])
removeBelowPercentile(seriesList, n) filter:values:percentile:gt
removeBelowValue(seriesList, n) find(...) | filter:all:gt([filter_value])
removeEmptySeries(seriesList, xFilesFactor=None) filter:all:<>:missing for the second arg, only 0 or 1 is supported
roundFunction(seriesList, precision=None) find(seriesList) | math:floor() precision is ignored, i.e. only rounds to integer
scale(seriesList, factor) find(...) | each:mul(x)
scaleToSeconds(seriesList, seconds) | each:mul(x) | each:div(60)
secondYAxis(seriesList) pass() CAQL is not supporting output picture manipulation, but user can choose second Y axis in graph options
smartSummarize(seriesList, intervalString, func='sum', alignTo=None) find(...) | window:<sum|count|mean|stddev|max|min|first|percentile>(<window_duration>) last is implemented as first in CAQL
sortBy(seriesList, func='average', reverse=False) pass() no need to sort in CAQL - passthrough
sortByMaxima(seriesList) pass() no need to sort in CAQL - passthrough
sortByMinima(seriesList) pass() no need to sort in CAQL - passthrough
sortByName(seriesList, natural=False, reverse=False) pass() no need to sort in CAQL - passthrough
sortByTotal(seriesList) pass() no need to sort in CAQL - passthrough
summarize(seriesList, intervalString, func='sum', alignToFrom=False) find(...) | window:sum() alignToFrom=True is ignored, last is implemented as first in CAQL
sum() alias for sumSeries()
sumSeries(*seriesLists) find(...) | stats:sum()
sumSeriesWithWildcards(seriesList, *position) find(seriesList) | graphite:removenode(position) | group_by:sum('__name')
timeShift(seriesList, timeShift, resetEnd=True, alignDST=False) | delay()
transformNull(seriesList, default=0, referenceSeries=None) find(...) | fill([value])
threshold(value, label=None, color=None) pass() CAQL is not supporting output picture manipulation
verticalLine(ts, label=None, color=None) pass() CAQL is not supporting output picture manipulation

Functions Not Yet Supported

The following Graphite functions are not currently available in CAQL but can be implemented.

Graphite Function
aggregateLine(seriesList, func='average', keepStep=False)
aliasByTags(seriesList, *tags)
aliasQuery(seriesList, search, replace, newName)
averageOutsidePercentile(seriesList, n)
cactiStyle(seriesList, system=None, units=None)
fallbackSeries(seriesList, fallback)
groupByTags(seriesList, callback, *tags)
highest(seriesList, n=1, func='average')
highestCurrent(seriesList, n)
holtWintersAberration(seriesList, delta=3, bootstrapInterval='7d', seasonality='1d')
holtWintersConfidenceArea(seriesList, delta=3, bootstrapInterval='7d', seasonality='1d')
holtWintersConfidenceBands(seriesList, delta=3, bootstrapInterval='7d', seasonality='1d')
holtWintersForecast(seriesList, bootstrapInterval='7d', seasonality='1d')
identity(name)
integralByInterval(seriesList, intervalUnit)
interpolate(seriesList, limit=inf)
legendValue(seriesList, *valueTypes)
linearRegression(seriesList, startSourceAt=None, endSourceAt=None)
linearRegressionAnalysis(series)
logit(seriesList)
lowest(seriesList, n=1, func='average')
lowestAverage(seriesList, n)
lowestCurrent(seriesList, n)
mapSeries(seriesList, *mapNodes)
mostDeviant(seriesList, n)
nPercentile(seriesList, n)
offsetToZero(seriesList)
percentileOfSeries(seriesList, n, interpolate=False)
rangeOfSeries(*seriesLists)
reduceSeries(seriesLists, reduceFunction, reduceNode, *reduceMatchers)
removeBetweenPercentile(seriesList, n)
roundFunction(seriesList, precision=None)
seriesByTag(*tagExpressions)
setXFilesFactor(seriesList, xFilesFactor)
sigmoid(seriesList)
sinFunction(name, amplitude=1, step=60)
squareRoot(seriesList)
stacked(seriesLists, stackName='__DEFAULT__')
stdev(seriesList, points, windowTolerance=0.1)
stddevSeries(*seriesLists)
substr(seriesList, start=0, stop=0)
timeFunction(name, step=60)
timeSlice(seriesList, startSliceAt, endSliceAt='now')
timeStack(seriesList, timeShiftUnit='1d', timeShiftStart=0, timeShiftEnd=7)
unique(*seriesLists)
useSeriesAbove(seriesList, value, search, replace)
weightedAverage(seriesListAvg, seriesListWeight, *nodes)

Functions that will not be supported

Graphite Function
applyByNode(seriesList, nodeNum, templateFunction, newName=None)