From 1b7f445ee52748e8eb056259316a53eb3dc0ef31 Mon Sep 17 00:00:00 2001 From: "Peter (Stig) Edwards" Date: Fri, 5 Mar 2021 15:25:45 +0000 Subject: [PATCH] Correct Q+A about state (#8918) --- plugins/processors/starlark/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/processors/starlark/README.md b/plugins/processors/starlark/README.md index 03d9f7a939250..c14c3e8bca2ed 100644 --- a/plugins/processors/starlark/README.md +++ b/plugins/processors/starlark/README.md @@ -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?**