Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct common question in the Starlark Processor README about shared state. #8907

Closed
thatsafunnyname opened this issue Feb 25, 2021 · 2 comments · Fixed by #8918
Closed
Labels
area/starlark docs Issues related to Telegraf documentation and configuration descriptions

Comments

@thatsafunnyname
Copy link
Contributor

Hello and thanks for telegraf.

After #8447 , this common question in the Starlark Processor README.md should be updated to reflect the newly available shared state:

https://github.com/influxdata/telegraf/blame/8ddbab47a46e256281392ad0aac876715189c117/plugins/processors/starlark/README.md#L166

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.

Suggest replacing this with:

A shared global dictionary named "state" exists, this can be used by the apply function.
See an example of this in plugins/processors/starlark/testdata/compare_metrics.star

Thanks

@thatsafunnyname thatsafunnyname added the bug unexpected problem or unintended behavior label Feb 25, 2021
@sjwang90
Copy link
Contributor

@thatsafunnyname would you want to submit a PR for changes to the README?

@sjwang90 sjwang90 added docs Issues related to Telegraf documentation and configuration descriptions and removed bug unexpected problem or unintended behavior labels Feb 25, 2021
@thatsafunnyname
Copy link
Contributor Author

I can do, I just need to wait for approval from my employer to sign the Individual CLA.

thatsafunnyname added a commit to thatsafunnyname/telegraf that referenced this issue Mar 1, 2021
For  influxdata#8907 .  After influxdata#8447  , this common question in the Starlark Processor README.md should be updated to reflect the newly available shared state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/starlark docs Issues related to Telegraf documentation and configuration descriptions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants