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

Replace index patterns in TSVB visualizations #7929

Merged
merged 1 commit into from
Aug 9, 2018

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Aug 9, 2018

When customizing the index pattern with setup.dashboards.index,
references to index patterns need to be replaced in imported dashboards.
It was not being done with objects that contain the index pattern in
the visState object, as is the case of TSVB visualizations.

@jsoriano jsoriano added bug in progress Pull request is currently in progress. libbeat :Dashboards labels Aug 9, 2018
return string(d)
}

func ReplaceIndexInDashboardObject(index string, content common.MapStr) common.MapStr {

Choose a reason for hiding this comment

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

exported function ReplaceIndexInDashboardObject should have comment or be unexported

return visStateJSON
}

index_pattern, ok := params["index_pattern"].(string)

Choose a reason for hiding this comment

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

don't use underscores in Go names; var index_pattern should be indexPattern

@@ -42,24 +42,29 @@ type JSONFormat struct {
}

func ReplaceIndexInIndexPattern(index string, content common.MapStr) common.MapStr {
Copy link
Member Author

@jsoriano jsoriano Aug 9, 2018

Choose a reason for hiding this comment

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

Changes here are not directly related, I have just reorganized the code to have less nesting levels in these functions. Result should be the same.

Copy link
Contributor

Choose a reason for hiding this comment

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

++ on the cleanup.

@jsoriano jsoriano force-pushed the visstate-index-pattern-replace branch from 8601e6d to 561cba2 Compare August 9, 2018 10:50
When customizing the index pattern with `setup.dashboards.index`,
references to index patterns need to be replaced in imported dashboards.
It was not being done with objects that contain the index pattern in
the `visState` object, as is the case of TSVB visualizations.
@jsoriano jsoriano force-pushed the visstate-index-pattern-replace branch from 561cba2 to b0fc21a Compare August 9, 2018 10:51
Copy link
Contributor

@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.

Probably this will also need a needs_backport label.

@@ -42,24 +42,29 @@ type JSONFormat struct {
}

func ReplaceIndexInIndexPattern(index string, content common.MapStr) common.MapStr {
Copy link
Contributor

Choose a reason for hiding this comment

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

++ on the cleanup.

@@ -69,3 +69,45 @@ func TestReplaceStringInDashboard(t *testing.T) {
assert.Equal(t, test.expected, result)
}
}

func TestReplaceIndexInDashboardObject(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Great, wanted to ask for tests :-)

@jsoriano jsoriano added the needs_backport PR is waiting to be backported to other branches. label Aug 9, 2018
@ruflin ruflin merged commit 7a8a476 into elastic:master Aug 9, 2018
@jsoriano
Copy link
Member Author

jsoriano commented Aug 9, 2018

@ruflin it was in progress, I was testing it, I think it is not working with metricbeat setup 😕

@jsoriano
Copy link
Member Author

jsoriano commented Aug 9, 2018

No, sorry, false alarm, it is working 😃

@jsoriano jsoriano removed the in progress Pull request is currently in progress. label Aug 9, 2018
@jsoriano jsoriano added v6.5.0 and removed needs_backport PR is waiting to be backported to other branches. labels Aug 9, 2018
jsoriano added a commit to jsoriano/beats that referenced this pull request Aug 9, 2018
When customizing the index pattern with `setup.dashboards.index`,
references to index patterns need to be replaced in imported dashboards.
It was not being done with objects that contain the index pattern in
the `visState` object, as is the case of TSVB visualizations.

(cherry picked from commit 7a8a476)
@jsoriano jsoriano added the v6.4.0 label Aug 9, 2018
jsoriano added a commit to jsoriano/beats that referenced this pull request Aug 9, 2018
When customizing the index pattern with `setup.dashboards.index`,
references to index patterns need to be replaced in imported dashboards.
It was not being done with objects that contain the index pattern in
the `visState` object, as is the case of TSVB visualizations.

(cherry picked from commit 7a8a476)
@ruflin
Copy link
Contributor

ruflin commented Aug 9, 2018

Sorry about the in progress part, should have had a closer look at the labels :-(

ruflin pushed a commit that referenced this pull request Aug 10, 2018
When customizing the index pattern with `setup.dashboards.index`,
references to index patterns need to be replaced in imported dashboards.
It was not being done with objects that contain the index pattern in
the `visState` object, as is the case of TSVB visualizations.

(cherry picked from commit 7a8a476)
ruflin pushed a commit that referenced this pull request Aug 10, 2018
When customizing the index pattern with `setup.dashboards.index`,
references to index patterns need to be replaced in imported dashboards.
It was not being done with objects that contain the index pattern in
the `visState` object, as is the case of TSVB visualizations.

(cherry picked from commit 7a8a476)
@jsoriano jsoriano deleted the visstate-index-pattern-replace branch November 7, 2018 17:17
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…#7932)

When customizing the index pattern with `setup.dashboards.index`,
references to index patterns need to be replaced in imported dashboards.
It was not being done with objects that contain the index pattern in
the `visState` object, as is the case of TSVB visualizations.

(cherry picked from commit f27fd7a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants