-
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
Check Kibana version for stats API availability #7697
Check Kibana version for stats API availability #7697
Conversation
metricbeat/module/kibana/kibana.go
Outdated
} | ||
|
||
var data common.MapStr | ||
json.Unmarshal(content, &data) |
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.
We should check the error here.
metricbeat/module/kibana/kibana.go
Outdated
defer http.SetURI(currentURI) // Reset after this request | ||
|
||
// Parse the URI to replace the path | ||
u, _ := url.Parse(currentURI) |
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.
Should we check the error here?
@@ -49,6 +58,13 @@ type MetricSet struct { | |||
xPackEnabled bool | |||
} | |||
|
|||
func isKibanaStatsAPIAvailable(kibanaVersion string) bool { | |||
currenVersion := semver.New(kibanaVersion) |
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.
We have an internal version package which could be used here.
@ruflin Addressed review feedback and squashed to single commit. |
metricbeat/module/kibana/kibana.go
Outdated
return "", err | ||
} | ||
|
||
return version.(string), nil |
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.
What if version.number
does not contain a string?
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.
WFG
Metricbeat will now exit with a helpful error message if the user is running against a version of Kibana that doesn't yet have the stats API implemented in it.
@ycombinator Can you create a follow up PR that cleans up the FIXME part? |
Metricbeat will now exit with a helpful error message if the user is running against a version of Kibana that doesn't yet have the stats API implemented in it.
To test this PR
Run Elasticsearch 6.3.0.
Run Kibana 6.3.0.
Using this PR, enable the kibana module in metricbeat.
Modify
modules.d/kibana.yml
and enable thestats
metricset.Run metricbeat.
Verify that metricbeat exits with a helpful error message about the Kibana stats API not being available.