influxdata / influxdata/helm-charts

[telegraf] Cannot use `starlark` script as it doesn't accept multipleline string under processors.starlark.source

Open
#544 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Mustache
Stars
257
Forks
347
Avg merge
4d 20h
Merged PRs (30d)
9

Description

Gotta issue when trying to implement starlark processor with this instruction [link](https://www.influxdata.com/blog/prometheus-remote-write-support-with-influxdb-2-0/)

###Helm value:
```yaml
config:
processors:
- enum:
mapping:
field: "status"
dest: "status_code"
value_mappings:
healthy: 1
problem: 2
critical: 3
- starlark:
source: |
def apply(metric):
if metric.name == "prometheus_remote_write":
for k, v in metric.fields.items():
metric.name = k
metric.fields["value"] = v
metric.fields.pop(k)
return metric
```
result in `configmap`:
```toml
[[processors.starlark]]
source = "def apply(metric):\n if metric.name == \"prometheus_remote_write\":\n for k, v in metric.fields.items():\n metric.name = k\n metric.fields[\"value\"] = v\n metric.fields.pop(k)\n return metric\n"

```
The issue I was thought it came from the template we had to wrapped by `processor` helm template function
Should we go with this like we did for `telegraf-ds` https://github.com/influxdata/helm-charts/pull/239
I would like to work on this :)

Contributor guide

Open the contributing guide

Research direction

Start by locating the processor Helm template that renders the starlark source, then compare it with the telegraf-ds change in PR #239. Render the chart with the multiline source from this issue and verify that the generated ConfigMap contains valid TOML preserving the script content.

Written by the indexing model from the issue text.

Assessment

Tech stack
helm
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.