Skip to content
This repository was archived by the owner on Sep 7, 2021. It is now read-only.

Commit 937c593

Browse files
author
Florentin DUBOIS
authored
Merge pull request #20 from ovh/feat/doc/mask
Feat/doc/mask
2 parents dd09dfe + 5382cc2 commit 937c593

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

spec/doc.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,15 @@ The following TSL methods can be used to apply limit operators on metrics:
457457
* The **maxWith** operator. MaxWith will test all values to keep only the one **above maxWith parameter** and **replace** all other values per maxWith parameter, example: *.maxWith(2)*
458458
* The **minWith** operator. MinWith will test all values to keep only the one **below minWith parameter** and **replace** all other values per minWith parameter, example: *.minWith(2)*
459459

460+
#### Metrics type convertor
461+
462+
The following TSL methods can be used to convert metrics values:
463+
464+
* The **toboolean** operator used to convert all metrics values to boolean, example: _.toboolean()._
465+
* The **todouble** operator used to convert all metrics values to double, example: _.todouble()._
466+
* The **tolong** operator used to convert all metrics values to long, example: _.tolong()._
467+
* The **tostring** operator used to convert all metrics values to long, example: _.tostring()._
468+
460469
#### Metrics time operators
461470

462471
The following TSL methods can be used to apply time related operators on metrics:
@@ -524,6 +533,9 @@ _For example: we can add the values of a first series with a second one. Value w
524533
* The **greaterOrEqual** operator between metrics sets, example: _greaterOrEqual(select(...), select(...), ...)_
525534
* The **lessThan** operator between metrics sets, example: _lessThan(select(...), select(...), ...)_
526535
* The **lessOrEqual** operator between metrics sets, example: _lessOrEqual(select(...), select(...), ...)_
536+
* The **mask** operator to use a [Warp 10 mask](https://www.warp10.io/doc/op.mask), example: _mask(select(...).toboolean(), select(...))_
537+
* The **negmask** operator to use a [Warp 10 negmask](https://www.warp10.io/doc/op.negmask), example: _negmask(select(...).toboolean(), select(...))_
538+
527539

528540
Example:
529541

tsl/generateWarpScript.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ func (protoParser *ProtoParser) getFrameworksOp(selectStatement SelectStatement,
246246
buffer.WriteString("\n")
247247
case ABS, ADDSERIES, ANDL, CEIL, COUNT, DAY, DELTA, DIVSERIES, EQUAL, FLOOR, GREATERTHAN, GREATEROREQUAL, LESSTHAN, LESSOREQUAL,
248248
LN, LOG2, LOG10, LOGN, HOUR, MAX, MAXWITH, MEAN, MEDIAN, MIN, MINWITH, MINUTE, MONTH, MULSERIES, NOTEQUAL, ORL, RATE, STDDEV, STDVAR,
249-
ROUND, SQRT, SUM, TIMESTAMP, WEEKDAY, YEAR, JOIN, PERCENTILE, CUMULATIVE, WINDOW, FINITE:
249+
ROUND, SQRT, SUM, TIMESTAMP, WEEKDAY, YEAR, JOIN, PERCENTILE, CUMULATIVE, WINDOW, FINITE, TOBOOLEAN, TODOUBLE, TOLONG, TOSTRING:
250250

251251
buffer.WriteString(protoParser.getMapper(framework, sampleSpan))
252252
buffer.WriteString("\n")

tsl/genericParser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ loop:
746746
if err != nil {
747747
return nil, err
748748
}
749-
case ABS, CEIL, CUMULATIVESUM, DAY, FLOOR, HOUR, LN, LOG2, LOG10, MINUTE, MONTH, ROUND, RESETS, SQRT, TIMESTAMP, WEEKDAY, YEAR:
749+
case ABS, CEIL, CUMULATIVESUM, DAY, FLOOR, HOUR, LN, LOG2, LOG10, MINUTE, MONTH, ROUND, RESETS, SQRT, TIMESTAMP, WEEKDAY, YEAR, TOBOOLEAN, TODOUBLE, TOLONG, TOSTRING:
750750
instruction, err = p.parseNoOperator(tok, pos, lit, instruction)
751751

752752
if err != nil {

tsl/token.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,12 @@ const (
151151
TIMESTAMP
152152
TIMESCALE
153153
TIMESPLIT
154+
TOBOOLEAN
155+
TODOUBLE
156+
TOLONG
154157
TOPN
155158
TOPNBY
159+
TOSTRING
156160
WARP
157161
WEEKDAY
158162
WHERE
@@ -284,8 +288,12 @@ var tokens = [...]string{
284288
STORE: "store",
285289
SUBSERIES: "sub",
286290
SUM: "sum",
291+
TOBOOLEAN: "toboolean",
292+
TODOUBLE: "todouble",
293+
TOLONG: "tolong",
287294
TOPN: "topN",
288295
TOPNBY: "topNBy",
296+
TOSTRING: "tostring",
289297
TIMECLIP: "timeclip",
290298
TIMEMODULO: "timemodulo",
291299
TIMESTAMP: "timestamp",

0 commit comments

Comments
 (0)