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

Bloblang for field values #542

Open
codingconcepts opened this issue Nov 2, 2020 · 2 comments
Open

Bloblang for field values #542

codingconcepts opened this issue Nov 2, 2020 · 2 comments

Comments

@codingconcepts
Copy link
Contributor

It would be great to have a list of fields that support Bloblang as described in the Interpolation page.

I'm hoping to spin up multiple Kafka consumers with different client_ids but the client_id doesn't seem to support Bloblang:

input:
    kafka_balanced:
        addresses:
            - localhost:9092
        topics: [ topic.1 ]
        client_id: ${! uuid_v4() }
        consumer_group: example

output:
  stdout: {}

The output of running against the above configuration is as follows:

{"@timestamp":"2020-11-02T20:21:19Z","@service":"benthos","level":"ERROR","component":"benthos.input","message":"Failed to connect to kafka_balanced: kafka: invalid configuration (ClientID is invalid)"}

Does this field support Bloblang, or have I misunderstood something?

@Jeffail
Copy link
Collaborator

Jeffail commented Nov 2, 2020

Hey @codingconcepts, unfortunately client_id doesn't support interpolations, they're mostly limited to fields that are useful to change based on messages passing through rather than cases like this that would be evaluated once on start up. A dirty work around might be to use an env var instead with client_id: ${CLIENT_ID}, and then when you execute the config set that var with something like CLIENT_ID=$(cat /proc/sys/kernel/random/uuid) benthos -c ./foo.yaml.

The fields that support interpolation already have notes on their docs, but it's not particularly clear and there's currently no way to quickly scan all interpolation fields. I'll mark this as a documentation enhancement and think about how this could be made more user friendly.

@codingconcepts
Copy link
Contributor Author

That'd be brilliant, thanks very much, @Jeffail!

Thanks for the suggestion of using env vars too, I'll see how this feels once implemented 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants