diff --git a/plugins/processors/starlark/testdata/number_logic.star b/plugins/processors/starlark/testdata/number_logic.star index 4ecd56890..719b61a9f 100644 --- a/plugins/processors/starlark/testdata/number_logic.star +++ b/plugins/processors/starlark/testdata/number_logic.star @@ -1,4 +1,11 @@ -# Set any 'status' field between 1 and 6 to a value of 0 +# Set a logic function to transform a numerical value to another numerical value +# Example: Set any 'status' field between 1 and 6 to a value of 0 +# +# Example Input: +# lb, http_method=GET status=5 1465839830100400201 +# Example Output: +# lb, http_method=GET status=0 1465839830100400201 + def apply(metric): v = metric.fields.get('status') diff --git a/plugins/processors/starlark/testdata/ratio.star b/plugins/processors/starlark/testdata/ratio.star index 086cd2e69..ee4f5b20a 100644 --- a/plugins/processors/starlark/testdata/ratio.star +++ b/plugins/processors/starlark/testdata/ratio.star @@ -1,4 +1,11 @@ # Compute the ratio of two integer fields. +# +# Example: A new field 'usage' from an existing fields 'used' and 'total' +# +# Example Input: +# memory, host=hostname used=11038756864.4948,total=17179869184.1221 1597255082000000000 +# Example Output: +# memory, host=hostname used=11038756864.4948,total=17179869184.1221,usage=64.254021647 1597255082000000000 def apply(metric): used = float(metric.fields['used']) diff --git a/plugins/processors/starlark/testdata/rename.star b/plugins/processors/starlark/testdata/rename.star index 51a372911..5c5be1120 100644 --- a/plugins/processors/starlark/testdata/rename.star +++ b/plugins/processors/starlark/testdata/rename.star @@ -1,4 +1,9 @@ # Rename any tags using the mapping in the renames dict. +# +# Example Input: +# measurement, host=hostname lower=0,upper=100 1597255410000000000 +# Example Output: +# measurement, host=hostname min=0,max=100 1597255410000000000 renames = { 'lower': 'min', diff --git a/plugins/processors/starlark/testdata/scale.star b/plugins/processors/starlark/testdata/scale.star index 502a13146..a71c5a9aa 100644 --- a/plugins/processors/starlark/testdata/scale.star +++ b/plugins/processors/starlark/testdata/scale.star @@ -1,4 +1,9 @@ # Multiply any float fields by 10 +# +# Example Input: +# modbus,host=hostname Current=1.22,Energy=0,Frequency=60i,Power=0,Voltage=123.9000015258789 1554079521000000000 +# Example Output: +# modbus,host=hostname Current=12.2,Energy=0,Frequency=60i,Power=0,Voltage=1239.000015258789 1554079521000000000 def apply(metric): for k, v in metric.fields.items():