Correct Q+A about state (#8918)

This commit is contained in:
Peter (Stig) Edwards 2021-03-05 15:25:45 +00:00 committed by GitHub
parent 858bcd4bba
commit 1b7f445ee5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -165,8 +165,8 @@ def apply(metric):
**How can I save values across multiple calls to the script?**
Telegraf freezes the global scope, which prevents it from being modified.
Attempting to modify the global scope will fail with an error.
A shared global dictionary named `state` exists, this can be used by the `apply` function.
See an example of this in [compare with previous metric](/plugins/processors/starlark/testdata/compare_metrics.star)
**How to manage errors that occur in the apply function?**