-
Notifications
You must be signed in to change notification settings - Fork 38
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
[BUG]Csv report generation had missing nested Fields #502
Conversation
Signed-off-by: sumukhswamy <[email protected]>
Signed-off-by: sumukhswamy <[email protected]>
} | ||
flattenedValues[newKey].push(item[subKey]); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems this only does it one level, does it work if the data is more nested like
{
"a": {
"b": {
"c": [
{
"d": [{ "e": 1 }, { "e": 2 }]
},
{
"d": [{ "e": 3 }, { "e": 4 }]
}
]
}
}
}
and could you add some unit tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have updated it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't really see any logic change in the new commits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding more comments here:
- This may be still only working with one level of array nesting
- Best way to check is by adding multi-level nested array of objects
- Nit -
Object.keys(data)
is looped twice can just keep it one.
Signed-off-by: sumukhswamy <[email protected]>
Signed-off-by: sumukhswamy <[email protected]>
Signed-off-by: sumukhswamy <[email protected]>
Signed-off-by: sumukhswamy <[email protected]>
Signed-off-by: sumukhswamy <[email protected]>
Signed-off-by: sumukhswamy <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #502 +/- ##
==========================================
+ Coverage 71.05% 71.22% +0.16%
==========================================
Files 31 31
Lines 2011 2054 +43
Branches 432 453 +21
==========================================
+ Hits 1429 1463 +34
- Misses 579 585 +6
- Partials 3 6 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: sumukhswamy <[email protected]>
Signed-off-by: sumukhswamy <[email protected]>
Signed-off-by: sumukhswamy <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as I commented here #502 (comment), this doesn't recurse, so it only flattens one level. For example, discover shows
{ "a": { "b": { "c": [ { "d": [{ "e": 1 }, { "e": 2 }] }, { "d": [{ "e": 3 }, { "e": 4 }] } ] } } }
as
a.b.c.d.e:1, 2, 3, 4
but reporting csv shows
_source.a.b.c
"[{""d"":[{""e"":1},{""e"":2}]},{""d"":[{""e"":3},{""e"":4}]}]"
but it's definitely better than not showing up at all
Signed-off-by: sumukhswamy <[email protected]> (cherry picked from commit c2ea8be) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
(cherry picked from commit c2ea8be) Signed-off-by: sumukhswamy <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
On generating a CSV report from a saved search in Dashboards, nestsed fields for the index pattern was not getting parsed in the picture below
RCA:
the code piece handling the nested fields only checked if the fields had a key with a . in them, it was ignoring the fields which had an array of objects to be added to the CSV file, the fix handles the nested array objects which are needed as a part of the nested fields
The fix handles all nested fields which were getting truncated
Issues Resolved
#375
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.