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

enhancement(lua transform)!: respect Lua types when converting back to events #1886

Merged
1 commit merged into from Feb 21, 2020

Conversation

sciyoshi
Copy link
Contributor

@sciyoshi sciyoshi commented Feb 21, 2020

When using the Lua transform with a function like this:

event["number"] = 42

the resulting event has the value converted back to a string:

{ ..., "number": "42", ... }

This PR changes the transform to preserve types, and also adds support for setting fields to boolean values, saving the need for further processing to restore the types. It also slightly changes the behavior to drop fields when set to invalid types, rather than erroring out the function. I'm not sure what impact this will have when it comes to #704, however.

Fixes #857.

@sciyoshi sciyoshi requested a review from a user February 21, 2020 04:00
…ectordotdev#857)

This also slightly changes the behavior to drop fields when set to invalid
values, rather than erroring out the function.

Signed-off-by: Samuel Cormier-Iijima <samuel@cormier-iijima.com>
@sciyoshi sciyoshi force-pushed the lua-event-fields-respect-types branch from 1aedbbb to 1ed6661 Compare February 21, 2020 04:01
@binarylogic binarylogic assigned ghost Feb 21, 2020
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thanks!

@ghost ghost changed the title fix(lua transform): respect Lua types when converting back to events enhancement(lua transform)!: respect Lua types when converting back to events Feb 21, 2020
@ghost ghost merged commit 650ce58 into vectordotdev:master Feb 21, 2020
@sciyoshi sciyoshi deleted the lua-event-fields-respect-types branch February 24, 2020 04:24
@cetanu
Copy link

cetanu commented Sep 4, 2020

I wonder if this can be updated to accept lua tables/arrays now that #704 is complete?

@cetanu cetanu unassigned ghost Sep 4, 2020
This pull request was closed.
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

Successfully merging this pull request may close these issues.

Lua transformer type loss
3 participants