Correct Q+A about state (#8918)
This commit is contained in:
parent
858bcd4bba
commit
1b7f445ee5
|
|
@ -165,8 +165,8 @@ def apply(metric):
|
||||||
|
|
||||||
**How can I save values across multiple calls to the script?**
|
**How can I save values across multiple calls to the script?**
|
||||||
|
|
||||||
Telegraf freezes the global scope, which prevents it from being modified.
|
A shared global dictionary named `state` exists, this can be used by the `apply` function.
|
||||||
Attempting to modify the global scope will fail with an error.
|
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?**
|
**How to manage errors that occur in the apply function?**
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue