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

import-beats: Decode fields layerListJSON, mapStateJSON #354

Merged
merged 4 commits into from
Apr 21, 2020

Conversation

mtojek
Copy link
Contributor

@mtojek mtojek commented Apr 20, 2020

This PR decodes two Kibana fields that have been already encoded in Beats: layerListJSON, mapStateJSON.

It's a followup of the PR comment: #352 (comment)

Actually I'm not sure if we should store them decode, could somebody from the Kibana team confirm that's correct?

@mtojek mtojek requested a review from ruflin April 20, 2020 10:31
@mtojek mtojek self-assigned this Apr 20, 2020
Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

At the moment, Kibana only supports encoded objects. If we change this list, we also need to change it here: https://github.com/elastic/package-registry/blob/master/dev/generator/main.go#L253

Storing it decode is for versioning purpose to be able to review diffs. This is something specific to packages.

"attributes.optionsJSON",
"attributes.panelsJSON",
"attributes.kibanaSavedObjectMeta.searchSourceJSON",
"attributes.uiStateJSON",
Copy link
Member

Choose a reason for hiding this comment

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

Why is encoded and decode not the same list?

Could you import this list from here https://github.com/elastic/package-registry/blob/master/dev/generator/main.go#L253 so we have a single point of truth?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not the same list, because some fields are already encoded in dashboards stored in Beats (see mapStateJSON in https://github.com/elastic/beats/blob/master/x-pack/filebeat/module/o365/_meta/kibana/7/dashboard/Filebeat-O365-Audit.json#L842).

Another solution would be detecting if the field is "string" and then try to decode it. WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I see. So we basically missed it already in Beats, I wonder if we should add it there @exekias .

A check for string would be nice as it would mean we only have to keep one list and things to break if the dashboards in Beats itself are adjusted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

@mtojek
Copy link
Contributor Author

mtojek commented Apr 20, 2020

At the moment, Kibana only supports encoded objects. If we change this list, we also need to change it here: https://github.com/elastic/package-registry/blob/master/dev/generator/main.go#L253

Storing it decode is for versioning purpose to be able to review diffs. This is something specific to packages.

I responded in the other comment.

@mtojek mtojek requested a review from ruflin April 20, 2020 12:12
@ruflin
Copy link
Member

ruflin commented Apr 20, 2020

Your code changes LGTM but you still have to update https://github.com/elastic/package-registry/blob/master/dev/generator/main.go#L253 with the new saved object list as otherwise the packages will be broken. I suggest we merge the two into 1, one using the other.

@mtojek
Copy link
Contributor Author

mtojek commented Apr 21, 2020

Your code changes LGTM but you still have to update https://github.com/elastic/package-registry/blob/master/dev/generator/main.go#L253 with the new saved object list as otherwise the packages will be broken. I suggest we merge the two into 1, one using the other.

Fixed, but I will keep merging aside not to introduce dependency between dev tools.

@mtojek mtojek merged commit 06e447f into elastic:master Apr 21, 2020
@ruflin
Copy link
Member

ruflin commented Apr 22, 2020

For linking, found the issue related to encoding objects in Kibana: elastic/kibana#43673

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.

2 participants