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

jsonnet $lookup function breaks the config in 1.27 #13449

Closed
khash opened this issue Jun 15, 2023 · 1 comment
Closed

jsonnet $lookup function breaks the config in 1.27 #13449

khash opened this issue Jun 15, 2023 · 1 comment
Labels
bug unexpected problem or unintended behavior

Comments

@khash
Copy link

khash commented Jun 15, 2023

Relevant telegraf.conf

[[outputs.http]]
  ...
  json_transformation = "$lookup($, 'metrics') ? metrics.{'name': $.name,'host': $.tags.host,'fields': $.fields,'tags': $.tags,'timestamp': $.timestamp} : [{'name': $.name,'host': $.tags.host,'fields': $.fields,'tags': $.tags,'timestamp': $.timestamp}]"

Logs from Telegraf

WARN[0000] The "lookup" variable is not set. Defaulting to a blank string.

System info

Ubuntu 20.04

Docker

No response

Steps to reproduce

  1. Use $lookup in a JSON transformer that works in 1.26.3 and then upgrade to 1.27.0 you will see the following warning and the transformer stops working: WARN[0000] The "lookup" variable is not set. Defaulting to a blank string.
  2. Replace $lookup with $$lookup in the config and 1.27.0 will work, but it won't work with 1.26.3

Expected behavior

Config from version 1.26.3 to work with 1.27.0 when containing jsonnet $ functions, like $lookup

Actual behavior

It should be possible to continue to use jsonnet $ functions in JSON transformer configs.

Additional info

The latest release, throws the following warning if $lookup (a jsonnet function) is used as a JSON transformer:

WARN[0000] The "lookup" variable is not set. Defaulting to a blank string.

Looking at the changelog notes, it might be due to the replacement of the parser. Given that this error is a generic Golang parser error, replacing the $lookup with $$lookup fixes the issue, but this means potentially many broken json transformers as this release is being used.

@khash khash added the bug unexpected problem or unintended behavior label Jun 15, 2023
@powersj
Copy link
Contributor

powersj commented Jun 15, 2023

Hi,

Closing this as a dup of #13432, working through the fix. Sorry about the regression!

@powersj powersj closed this as not planned Won't fix, can't repro, duplicate, stale Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants