influxdata / influxdata/telegraf

persist starlark state for more starlark types

Open
#15,924 5 comments 0 reactions 0 assignees View on GitHub
area/starlark feature request help wanted size/m
Dominant language
Go
Stars
17.8k
Forks
5.8k
Avg merge
1d 20h
Merged PRs (30d)
161

Description

### Use Case

#15170 added the ability for the starlark processor to persist the global state to the statefile between runs. This is very nice, but it can't store lists, dicts, tuples, or metrics to the state file which severely limits its usefulness. If you try any more complex type you get an error like `invalid starlark type *starlark.Metric` when it tries to write the state file.

My desired use case is similar to [the example](https://github.com/influxdata/telegraf/blob/e00bc7288c6f2f27e82ad741ced023c75ee4a998/plugins/processors/starlark/testdata/compare_metrics.star) for comparing a metric to the previous one. This doesn't work because it stores both a dict and a metric in the global state.

### Expected behavior

Starlark standard types (lists, dicts, tuples, and maybe also metrics) can be persisted to the statefile.

### Actual behavior

Error when persisting the plugin states.

### Additional info

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the starlark processor's state persistence and the comparison example at plugins/processors/starlark/testdata/compare_metrics.star, then review the persistence change from #15170. Done means lists, dicts, tuples, and possibly metrics can round-trip through the statefile without the reported invalid starlark type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.