Skip to main content

Graphite to CAQL Conversion

Supported Functions

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

Graphite FunctionCAQL EquivalentNotes
absolute(seriesList)math:abs()
add(seriesList, constant)find(...) \| each:add(x)
aggregate(seriesList, func, xFilesFactor=None)find(...) \| stats:<func>('VIEW_PERIOD')
aggregateLine(seriesList, func='average', keepStep=False)find(...) \| rolling:<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>)
aliasByTags(seriesList, *tags)find(...) \| graphite:aliasbytags(tag1, tag2...)
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)
averageOutsidePercentile(seriesList, n)find(...) \| graphite:averageoutsidepercentile(lower_percentile=n)
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])
constantLine(value)time:epoch() \| op:gt(0) \| each:mul(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:labelqueries 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)
fallbackSeries(seriesList, fallback)`if{graphite:find(seriesList)count(),graphite:find(seriesList),graphite:find(fallback)}`
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)
groupByTags(seriesList, callback, *tags)group_by::<agg>(__tag)
highest(seriesList, n=1, func='average')find(...) \| sort:<func> \| filter:limit(n)func can be only max, min and average
highestAverage(seriesList, n)\| top(1)
highestMax(seriesList, n)\| top(1, method="max")
hitcount(seriesList, intervalString, alignToInterval=False)\| window:sum(interval) \| each:mul(interval)
holtWintersAberration(seriesList, delta=3, bootstrapInterval='7d', seasonality='1d')graphite:holtwintersaberration
holtWintersConfidenceArea(seriesList, delta=3, bootstrapInterval='7d', seasonality='1d')graphite:holtwintersconfidencebandsCan be translated as AreaBetween(holtWintersConfidenceBands(...)) but AreaBetween() is just pass() in CAQL
holtWintersConfidenceBands(seriesList, delta=3, bootstrapInterval='7d', seasonality='1d')graphite:holtwintersconfidencebands
holtWintersForecast(seriesList, bootstrapInterval='7d', seasonality='1d')graphite:holtwintersforecast
identity(name)time:epoch() \| label('name')
integral(seriesList)find(...) \| integrate
integralByInterval(seriesList, intervalUnit)find(seriesList) \| graphite:integralbyinterval(interval=intervalUnit)
interpolate(seriesList, limit=inf)find(seriesList) \| graphite:interpolate(limit=N)
invert(seriesList)op:exp(-1)
isNonNull(seriesList)\| count()
keepLastValue(seriesList, limit=inf)find(...) \| fill:forwardsecond argument ignored
legendValue(seriesList, *valueTypes)pass()CAQL is not supporting output picture manipulation
limit(seriesList, n)filter:limit()
linearRegression(seriesList, startSourceAt=None, endSourceAt=None)find(seriesList) \| graphite:linearregression(bootstrap=N)Only startSourceAt parameter supported, in relative form, e.g. '-2d'
lineWidth(seriesList, width)pass()CAQL is not supporting output picture manipulation
logarithm(seriesList, base=10)find(seriesList) \| math:log(base)
logit(seriesList)\| math:logit()
lowest(seriesList, n=1, func='average')find(...) \| sort:<func>(reverse=1) \| filter:limit(n)func can be only max, min and average
lowestAverage(seriesList, n)find(...) \| sort:mean(reverse=1) \| filter:limit(n)
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)
nPercentile(seriesList, n)find(...) \| rolling:percentile(VIEW_PERIOD,n)
offset(seriesList, factor)find(...) \| each:add(x)
offsetToZero(seriesList)graphite:offsettozero()
rangeOfSeries(*seriesLists)graphite:rangeofseries()
percentileOfSeries(seriesList, n, interpolate=False)find(...) \| stats:percentile(N)
perSecond(seriesList, maxValue=None, minValue=None)find() \| counter()
pieAverage(series)find(...) \| stats:meanCAQL not supporting pie graphs, but we're replacing it with average function
pieMaximum(series)find(...) \| stats:maxCAQL not supporting pie graphs, but we're replacing it with max function
pieMinimum(series)find(...) \| stats:minCAQL 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])
removeBetweenPercentile(seriesList, n)find(...) \| graphite:removebetweenpercentile(lower_percentile=n)
removeEmptySeries(seriesList, xFilesFactor=None)filter:all:<>:missingfor 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
setXFilesFactor(seriesList, xFilesFactor)pass()setXFilesFactor has not many sense in CAQL
sigmoid(seriesList)\| math:sigmoid()
sinFunction(name, amplitude=1, step=60)\| math:sin() \| each:mul(amplitude)Step is not supported because it's outside of CAQL control
smartSummarize(seriesList, intervalString, func='sum', alignTo=None)find(...) \| window:<sum\|count\|mean\|stddev\|max\|min\|first\|last\|percentile>(<window_duration>)
sortBy(seriesList, func='average', reverse=False)... \| sort:<func>(reverse=X)func can be only max, min and average
sortByMaxima(seriesList)... \| sort:max()
sortByMinima(seriesList)... \| filter:all:gt(0) \| sort:min()
sortByName(seriesList, natural=False, reverse=False)... \| sort:name
sortByTotal(seriesList)pass()no need to sort in CAQL - passthrough
squareRoot(seriesList)\| each:exp(0.5)
stddevSeries(*seriesLists)find(...) \| stats:stddev()
stdev(seriesList, points, windowTolerance=0.1)find(...) \| rolling:stddev(<points>M)points assumed in minutes, windowTolerance ignored
substr(seriesList, start=0, stop=0)\| graphite:substr(start, stop)
summarize(seriesList, intervalString, func='sum', alignToFrom=False)find(...) \| window:sum()alignToFrom=True is ignored
sum()alias for sumSeries()
sumSeries(*seriesLists)find(...) \| stats:sum()
sumSeriesWithWildcards(seriesList, *position)find(seriesList) \| graphite:removenode(position) \| group_by:sum('__name')
time(name, step=60)time:epoch() \| label("name")Alias for timeFunction(), see below
timeFunction(name, step=60)time:epoch() \| label("name")Step is not supported because it's outside of CAQL control
timeShift(seriesList, timeShift, resetEnd=True, alignDST=False)\| delay()
timeSlice(seriesList, startSliceAt, endSliceAt='now')\| filter:whence()startSliceAt/endSliceAt parameters can be either absolute unix timestamp or relative format (e.g. '-6h')
transformNull(seriesList, default=0, referenceSeries=None)find(...) \| fill([value])
threshold(value, label=None, color=None)pass()CAQL is not supporting output picture manipulation
unique(*seriesLists)find(...) \| filter:label:unique()
useSeriesAbove(seriesList, value, search, replace)\| filter:any:geq(value) \| graphite:aliassub(search, replace)
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
aliasQuery(seriesList, search, replace, newName)
cactiStyle(seriesList, system=None, units=None)
highestCurrent(seriesList, n)
lowestCurrent(seriesList, n)
mapSeries(seriesList, *mapNodes)
mostDeviant(seriesList, n)
reduceSeries(seriesLists, reduceFunction, reduceNode, *reduceMatchers)
seriesByTag(*tagExpressions)
stacked(seriesLists, stackName='__DEFAULT__')
timeStack(seriesList, timeShiftUnit='1d', timeShiftStart=0, timeShiftEnd=7)
weightedAverage(seriesListAvg, seriesListWeight, *nodes)

Functions that will not be supported

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