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

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

Open
hungran opened this issue Mar 10, 2023 · 0 comments

Comments

@hungran
Copy link

hungran commented Mar 10, 2023

Gotta issue when trying to implement starlark processor with this instruction link

###Helm value:

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:

   [[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 #239
I would like to work on this :)

@hungran hungran changed the title [telegraf] Cannot use starlark script as it doesn't accept multipleline string under processors.starlark.source [WIP][telegraf] Cannot use starlark script as it doesn't accept multipleline string under processors.starlark.source Mar 10, 2023
@hungran hungran changed the title [WIP][telegraf] Cannot use starlark script as it doesn't accept multipleline string under processors.starlark.source [telegraf] Cannot use starlark script as it doesn't accept multipleline string under processors.starlark.source Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant