-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 the references of dashboard assets using the Saved Objects API #27647
Import the references of dashboard assets using the Saved Objects API #27647
Conversation
Pinging @elastic/agent (Team:Agent) |
@@ -69,7 +69,7 @@ func KibanaDashboards(moduleDirs ...string) error { | |||
// Convert 7.x dashboards to strings. | |||
err = sh.Run(pythonExe, | |||
filepath.Join(esBeatsDir, "libbeat/scripts/unpack_dashboards.py"), |
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.
Oh, a script we should migrate to go (not now 🙂).
continue | ||
} | ||
referencePath := filepath.Join(base, "..", ref.Type, ref.ID+".json") | ||
err := loader.ImportDashboard(referencePath) |
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.
Adrian mentioned that Kibana "fails" with status 200 if it cannot import any dashboard because of missing references. Should we check the content of the response in ImportDashboards
so we detect this kind of issues earlier?
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.
Updated.
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪💚 Flaky test reportTests succeeded. Expand to view the summary
Test stats 🧪
|
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.
👍
if !kibanaResult.Success { | ||
var errs multierror.Errors | ||
for _, err := range kibanaResult.Errors { | ||
errs = append(errs, fmt.Errorf("error: %s, asset ID=%s; asset type=%s; references=%+v", err.Error.Type, err.Id, err.Type, err.Error.References)) |
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 guess that there can be other types of errors here, and other errors may not have anything to do with references, so err.Error.Refereces
will be nil
. But we can revisit this later if we find this is problematic, or we need to get more info for for other kinds of errors.
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.
The whole error parsing from Kibana is very fragile, so I agree. I have removed the previous error check because it is just going to break. It would be nice if we could get HTTP errors when errors do happen: e.g. missing references.
…#27647) (#27664) ## What does this PR do? This PR changes the dashboard loading by first loading its references and then loading the dashboards. ## Why is it important? If the assets are not loaded in the proper order, the import can fail with unknown references. (cherry picked from commit b90370d) Co-authored-by: Noémi Ványi <kvch@users.noreply.github.com>
…#27647) (#27665) This PR changes the dashboard loading by first loading its references and then loading the dashboards. If the assets are not loaded in the proper order, the import can fail with unknown references. (cherry picked from commit b90370d) Co-authored-by: Noémi Ványi <kvch@users.noreply.github.com>
* master: Forward port 7.14.1 changelog to master (elastic#27687) Addressing multiple dashboard issues: deps loading once, field conversion, etc. (elastic#27669) Remove adaptive queue sizes from agent's spec files (elastic#27653) Osquerybeat: Improve testability and unit test coverage (elastic#27591) Osquerybeat: lockdown flagsfile, prevent global defaults (elastic#27611) Import the references of dashboard assets using the Saved Objects API (elastic#27647) Fix bug with override path in cgroups (elastic#27620) Allow Kibana client to authorize with Elasticsearch API key (elastic#27540) Filebeat auditd: Fix Top Exec Commands dashboard visualization (elastic#27638) [elastic-agent] Fix docker tar.gz generation for complete image (elastic#27621) Follow up changes in dashboards in mage check && fix minor issue (elastic#27553) [Heartbeat] Fix bug where `enabled: false` is ignored. (elastic#27615) Support kube_state_metrics v2.0.0 (elastic#27552)
…elastic#27647) ## What does this PR do? This PR changes the dashboard loading by first loading its references and then loading the dashboards. ## Why is it important? If the assets are not loaded in the proper order, the import can fail with unknown references.
What does this PR do?
This PR changes the dashboard loading by first loading its references and then loading the dashboards.
Why is it important?
If the assets are not loaded in the proper order, the import can fail with unknown references.
Checklist
- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration files- [ ] I have added tests that prove my fix is effective or that my feature works- [ ] I have added an entry inCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.