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

Add Starlark parsing example of nested JSON #8675

Merged
merged 4 commits into from
Mar 9, 2021

Conversation

samhld
Copy link
Contributor

@samhld samhld commented Jan 11, 2021

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

@sjwang90 sjwang90 added docs Issues related to Telegraf documentation and configuration descriptions area/starlark labels Jan 12, 2021
in the input collecting the JSON data. The entire JSON obj/doc will
be set to a Field named `value` with which this code will work.

Example input: ```
Copy link
Contributor

Choose a reason for hiding this comment

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

Has to be

Suggested change
Example input: ```
Example Input: ```

Copy link
Contributor

Choose a reason for hiding this comment

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

Furthermore I'm not sure if the current implementation of the test can cope with multi-line input. AFAIK we read one input per line, so please remove the nice formatting and make it an ugly one-liner. Never thought I will say this ever... ;-)

Copy link
Contributor

Choose a reason for hiding this comment

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

Last but not least the given input/output has to be in line-protocol format... Please fix those issues to keep the starlark test-suite working...

},
"timestamp": 1591124461
} ```
Example output:
Copy link
Contributor

Choose a reason for hiding this comment

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

Has to be Example Output.

Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

The starlark testdata directory contains testable examples. To run those tests the Example Input and Example Output have to be in influx-line-protocol format. Please fix those. Code looks good.

@srebhan srebhan self-assigned this Jan 20, 2021
Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thank you very much!

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Feb 15, 2021
@samhld
Copy link
Contributor Author

samhld commented Feb 16, 2021

@srebhan this commit shouldn't have been part of the PR. I still need to make the changes you mentioned to this one. I crossed PRs accidentally.

@srebhan
Copy link
Contributor

srebhan commented Feb 16, 2021

@samhld you can still change the PR and force-push it to replace it completely. I will remove the "ready-to-merge" flag for the time being. Please tell me once you are ready...

@srebhan srebhan removed the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Feb 16, 2021
@samhld
Copy link
Contributor Author

samhld commented Feb 17, 2021

ok @srebhan this one should be good to go too!



load("json.star", "json")
load("logging.star", "log")
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is not required anymore!?

Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Please remove the import of logging.star. Otherwise it's good to go.

@srebhan
Copy link
Contributor

srebhan commented Mar 5, 2021

@samhld any news on this?

@samhld
Copy link
Contributor Author

samhld commented Mar 5, 2021

@srebhan Missed this, sorry! Done.

Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Looks good.

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Mar 9, 2021
@sspaink sspaink merged commit 380911f into influxdata:master Mar 9, 2021
ssoroka pushed a commit that referenced this pull request Mar 10, 2021
* Add Starlark parsing example of nested JSON

* add correct Example Input and Output fields to make script testable

* removed logging from script

* remove logging.star load statement

(cherry picked from commit 380911f)
arstercz pushed a commit to arstercz/telegraf that referenced this pull request Mar 5, 2023
* Add Starlark parsing example of nested JSON

* add correct Example Input and Output fields to make script testable

* removed logging from script

* remove logging.star load statement

(cherry picked from commit 380911f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/starlark docs Issues related to Telegraf documentation and configuration descriptions ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants