-
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
Adding cluster_stats metricset for elasticsearch module #7638
Adding cluster_stats metricset for elasticsearch module #7638
Conversation
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package cluster_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.
don't use an underscore in package name
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package cluster_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.
don't use an underscore in package name
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package cluster_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.
don't use an underscore in package name
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package cluster_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.
don't use an underscore in package name
|
||
// +build !integration | ||
|
||
package cluster_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.
don't use an underscore in package name
d579910
to
bebda92
Compare
"id": "njqU4EQaTROIDlWPeUMQyw", | ||
"name": "elasticsearch", | ||
"stats": { | ||
"indices": { |
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.
How does the cluster index data overlap with the index
and node_stats
metricset 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.
-
index
metricset hasdocs
,segments
, andstore
which are also present in this metricset here. -
node_stats
metricset hasdocs
,segments
, andstore
, which are also present in this metricset here. -
node_stats
metricset also hasfs
andjvm
stats, which are currently not present in this metricset here but are available from the ElasticsearchGET _cluster/stats
API. -
This metricset here has
shards
which is absent in theindex
metricset and also not available from the ElasticsearchGET _stats
API. -
This metricset here has
shards
which is absent in thenode_stats
metricset and also not available from the ElasticsearchGET _nodes/_local
API or theGET _nodex/_local/stats
API. -
This metricset here has
fielddata
which is absent in theindex
metricset but is available from the ElasticsearchGET _stats
API. -
This metricset here has
fielddata
which is absent in thenode_stats
metricset and also not available from the ElasticsearchGET _nodes/_local
API. However it is available from the ElasticsearchGET _nodes/_local/stats
API. Of course, the latter API is missing a bunch of other fields that are present in the former API so either we call both or we ask the ES team to enhance the latter API's response to include all the fields we use from the former API's response as well.
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 do need to fix the field names in this metricset here so they match up with the ones in other elasticsearch
metricsets (e.g. I need to use count
instead of total
, etc.)
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.
Field names fixed in 6662787.
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 report all the data we have in the index and node_stats metricset here too? Or should we focus on the data points that other metricsets don't have?
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 think to start off we can only report the stats that are not already covered by other metricsets. Concretely, those would be fielddata
and shards
fields.
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.
++
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.
Fixed in 27ef3fb.
|
||
event.ModuleFields = common.MapStr{} | ||
event.ModuleFields.Put("cluster.name", info.ClusterName) // TODO cluster_name from cluster stats response could be used here? | ||
event.ModuleFields.Put("cluster.id", info.ClusterID) // TODO: Can we get this returned in cluster stats response itself? |
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 think both values are a must to be returned y cluster stats API
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.
Created elastic/elasticsearch#32205 to request cluster UUID from cluster stats API itself.
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.
... and put up PR as well: elastic/elasticsearch#32206
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.
Keep in mind that older versions of ES will not have it in, so in these cases we need to skip 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.
Good point! Should we skip it or make the extra API call in that case (I realize that complicates the logic/organization of the code a fair bit)?
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.
Lets skip it to not add more complexity. New versions, new features :-)
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.
Fixed in ed74319b4.
ed74319
to
290e7a8
Compare
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.
Code LGTM. Could you add a CHANGELOG entry?
- name: count | ||
type: long | ||
description: > | ||
Total number of shards in cluster |
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.
Apply to all lines: I think normally we put a dot at the end for the docs.
@@ -0,0 +1,147 @@ | |||
{ |
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.
Can we also have one for 630?
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.
Added in a5953bd.
@ycombinator Looks like this could be merged before the ES PR is merged as we do check if the field exists? Could you rebase and directly squash the commits? |
Yes, good point @ruflin. I will fix up this PR now so it can be reviewed/merged soon. |
346ba91
to
69ee642
Compare
69ee642
to
766b7f3
Compare
This PR adds a
cluster_stats
metricset for theelasticsearch
Metricbeat module. Only an initial set of fields are added by this PR.For follow up PRs