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

Fixes table in Data Prepper write_json processor #7518

Merged
merged 3 commits into from
Jul 10, 2024
Merged

Conversation

hdhalter
Copy link
Contributor

Description

Fixes the table and the JSON.

Issues Resolved

Closes #7457

Version

all

Frontend features

If you're submitting documentation for an OpenSearch Dashboards feature, add a video that shows how a user will interact with the UI step by step. A voiceover is optional.

Checklist

  • By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and subject to the Developers Certificate of Origin.
    For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Heather Halter <[email protected]>
@hdhalter hdhalter added 3 - Tech review PR: Tech review in progress backport 2.15 labels Jun 26, 2024
@hdhalter hdhalter changed the title fixtable Fixes table in Data Prepper write_json processor Jun 26, 2024
@@ -13,6 +13,6 @@ The `write_json` processor converts an object in an event into a JSON string. Yo

| Option | Description | Example |
| :--- | :--- | :--- |
| source | Mandatory field that specifies the name of the field in the event containing the message or object to be parsed. | If `source` is set to `"message"` and the input is `{"message": {"key1":"value1", "key2":{"key3":"value3"}}`, then the `write_json` processor generates `{"message": "{\"key1\":\"value`\", \"key2\":"{\"key3\":\"value3\"}"}"`.
| target | An optional field that specifies the name of the field in which the resulting JSON string should be stored. If `target` is not specified, then the `source` field is used.
| source | Mandatory field that specifies the name of the field in the event containing the message or object to be parsed. | If `source` is set to `"message"` and the input is `{"message": {"key1":"value1", "key2":{"key3":"value3"}}}`, then the `write_json` processor generates `{"message": "{\"key1\":\"value\", \"key2\":{\"key3\":\"value3\"}}"}`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason the example needed to change? Also, adding the line at the end will fix the table.

Suggested change
| source | Mandatory field that specifies the name of the field in the event containing the message or object to be parsed. | If `source` is set to `"message"` and the input is `{"message": {"key1":"value1", "key2":{"key3":"value3"}}}`, then the `write_json` processor generates `{"message": "{\"key1\":\"value\", \"key2\":{\"key3\":\"value3\"}}"}`.
| source | Mandatory field that specifies the name of the field in the event containing the message or object to be parsed. | If `source` is set to `"message"` and the input is `{"message": {"key1":"value1", "key2":{"key3":"value3"}}}`, then the `write_json` processor generates `{"message": "{\"key1\":\"value\", \"key2\":{\"key3\":\"value3\"}"}"`. |

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was trying to fix the formatting:
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dlvenable is going to take a look and help clarify.

@@ -13,6 +13,6 @@ The `write_json` processor converts an object in an event into a JSON string. Yo

| Option | Description | Example |
| :--- | :--- | :--- |
| source | Mandatory field that specifies the name of the field in the event containing the message or object to be parsed. | If `source` is set to `"message"` and the input is `{"message": {"key1":"value1", "key2":{"key3":"value3"}}`, then the `write_json` processor generates `{"message": "{\"key1\":\"value`\", \"key2\":"{\"key3\":\"value3\"}"}"`.
| target | An optional field that specifies the name of the field in which the resulting JSON string should be stored. If `target` is not specified, then the `source` field is used.
| source | Mandatory field that specifies the name of the field in the event containing the message or object to be parsed. | If `source` is set to `"message"` and the input is `{"message": {"key1":"value1", "key2":{"key3":"value3"}}}`, then the `write_json` processor generates `{"message": "{\"key1\":\"value\", \"key2\":{\"key3\":\"value3\"}}"}`.
Copy link
Member

Choose a reason for hiding this comment

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

I just noticed two small errors. This should be:

"{\"key1\":\"value1\",\"key2\":{\"key3\":\"value3\"}}"

Copy link
Member

Choose a reason for hiding this comment

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

To clarify, the part that is generated should be:

"{\"key1\":\"value1\",\"key2\":{\"key3\":\"value3\"}}"

You have a value instead of value1 and also a space. The string will not have any spaces, and this may be a significant change.

@@ -13,6 +13,6 @@ The `write_json` processor converts an object in an event into a JSON string. Yo

| Option | Description | Example |
| :--- | :--- | :--- |
| source | Mandatory field that specifies the name of the field in the event containing the message or object to be parsed. | If `source` is set to `"message"` and the input is `{"message": {"key1":"value1", "key2":{"key3":"value3"}}`, then the `write_json` processor generates `{"message": "{\"key1\":\"value`\", \"key2\":"{\"key3\":\"value3\"}"}"`.
| target | An optional field that specifies the name of the field in which the resulting JSON string should be stored. If `target` is not specified, then the `source` field is used.
| source | Mandatory field that specifies the name of the field in the event containing the message or object to be parsed. | If `source` is set to `"message"` and the input is `{"message": {"key1":"value1", "key2":{"key3":"value3"}}}`, then the `write_json` processor generates `{"message": "{\"key1\":\"value\", \"key2\":{\"key3\":\"value3\"}}"}`.
Copy link
Member

Choose a reason for hiding this comment

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

Also, we might want to reword this.

then the write_json processor generates

What is really happening is that write_json changes the existing event to look like what you show.

So perhaps:

then the write_json outputs the event

@hdhalter hdhalter added 4 - Doc review PR: Doc review in progress and removed 3 - Tech review PR: Tech review in progress labels Jul 5, 2024
@hdhalter hdhalter assigned Naarcha-AWS and unassigned dlvenable Jul 5, 2024
@Naarcha-AWS Naarcha-AWS requested a review from dlvenable July 8, 2024 17:29
Signed-off-by: Naarcha-AWS <[email protected]>
@Naarcha-AWS
Copy link
Collaborator

@dlvenable: Mind taking another look at this one?

@hdhalter hdhalter merged commit f2d1cd5 into main Jul 10, 2024
7 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 10, 2024
* fixtable

Signed-off-by: Heather Halter <[email protected]>

* Apply suggestions from code review

Signed-off-by: Naarcha-AWS <[email protected]>

* Update write_json.md

Signed-off-by: Naarcha-AWS <[email protected]>

---------

Signed-off-by: Heather Halter <[email protected]>
Signed-off-by: Naarcha-AWS <[email protected]>
Co-authored-by: Naarcha-AWS <[email protected]>
(cherry picked from commit f2d1cd5)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
leanneeliatra pushed a commit to leanneeliatra/opensearch-documentation-website-forl that referenced this pull request Jul 24, 2024
…7518)

* fixtable

Signed-off-by: Heather Halter <[email protected]>

* Apply suggestions from code review

Signed-off-by: Naarcha-AWS <[email protected]>

* Update write_json.md

Signed-off-by: Naarcha-AWS <[email protected]>

---------

Signed-off-by: Heather Halter <[email protected]>
Signed-off-by: Naarcha-AWS <[email protected]>
Co-authored-by: Naarcha-AWS <[email protected]>
Signed-off-by: [email protected] <[email protected]>
sandervandegeijn pushed a commit to sandervandegeijn/documentation-website that referenced this pull request Jul 30, 2024
…7518)

* fixtable

Signed-off-by: Heather Halter <[email protected]>

* Apply suggestions from code review

Signed-off-by: Naarcha-AWS <[email protected]>

* Update write_json.md

Signed-off-by: Naarcha-AWS <[email protected]>

---------

Signed-off-by: Heather Halter <[email protected]>
Signed-off-by: Naarcha-AWS <[email protected]>
Co-authored-by: Naarcha-AWS <[email protected]>
Signed-off-by: Sander van de Geijn <[email protected]>
@Naarcha-AWS Naarcha-AWS deleted the tableproblem branch December 19, 2024 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - Doc review PR: Doc review in progress backport 2.15
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DOC] DataPrepper write_json processor
3 participants