Add note about json processing to docs

This commit is contained in:
Steven Soroka 2020-09-30 16:20:50 -04:00 committed by GitHub
parent b88f05592e
commit 4fa620fd6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -91,6 +91,14 @@ While Starlark is similar to Python, there are important differences to note:
except is yield
```
### Libraries available
The ability to load external scripts other than your own is pretty limited. The following libraries are available for loading:
* json: `load("json.star", "json")` provides the following functions: `json.encode()`, `json.decode()`, `json.indent()`. See [json.star](/plugins/processors/starlark/testdata/json.star) for an example.
If you would like to see support for something else here, please open an issue.
### Common Questions
**How can I drop/delete a metric?**
@ -149,11 +157,12 @@ Attempting to modify the global scope will fail with an error.
### Examples
- [json](/plugins/processors/starlark/testdata/json.star) - an example of processing JSON from a field in a metric
- [number logic](/plugins/processors/starlark/testdata/number_logic.star) - transform a numerical value to another numerical value
- [pivot](/plugins/processors/starlark/testdata/pivot.star) - Pivots a key's value to be the key for another key.
- [ratio](/plugins/processors/starlark/testdata/ratio.star) - Compute the ratio of two integer fields
- [rename](/plugins/processors/starlark/testdata/rename.star) - Rename tags or fields using a name mapping.
- [scale](/plugins/processors/starlark/testdata/scale.star) - Multiply any field by a number
- [number logic](/plugins/processors/starlark/testdata/number_logic.star) - transform a numerical value to another numerical value
- [pivot](/plugins/processors/starlark/testdata/pivot.star) - Pivots a key's value to be the key for another key.
- [value filter](/plugins/processors/starlark/testdata/value_filter.star) - remove a metric based on a field value.
[All examples](/plugins/processors/starlark/testdata) are in the testdata folder.