Repository: elastic/rally

Issue:
Simplify filtering node-stats-related documents in Kibana
The current structure of node-stats documents does not allow for easy filtering in Kibana because we don't have an explicit property in the documents that allow identify them. Hence, we should add a property (e.g. `"name": "node-stats"`) to clearly indicate that.

Discussion:

Patch:
diff --git a/esrally/mechanic/telemetry.py b/esrally/mechanic/telemetry.py
index 70166f13..d6c13a1a 100644
--- a/esrally/mechanic/telemetry.py
+++ b/esrally/mechanic/telemetry.py
@@ -483,6 +483,7 @@ class NodeStatsRecorder:
         for node_stats in current_sample:
             node_name = node_stats["name"]
             collected_node_stats = collections.OrderedDict()
+            collected_node_stats["name"] = "node-stats"
 
             if self.include_indices:
                 collected_node_stats.update(


Test patch:
diff --git a/tests/mechanic/telemetry_test.py b/tests/mechanic/telemetry_test.py
index 687fda21..17cb2c4c 100644
--- a/tests/mechanic/telemetry_test.py
+++ b/tests/mechanic/telemetry_test.py
@@ -680,7 +680,11 @@ class NodeStatsRecorderTests(TestCase):
         recorder = telemetry.NodeStatsRecorder(telemetry_params, cluster_name="remote", client=client, metrics_store=metrics_store)
         recorder.record()
 
-        metrics_store_put_doc.assert_called_once_with(NodeStatsRecorderTests.default_stats_response_flattened,
+        expected_doc = collections.OrderedDict()
+        expected_doc["name"] = "node-stats"
+        expected_doc.update(NodeStatsRecorderTests.default_stats_response_flattened)
+
+        metrics_store_put_doc.assert_called_once_with(expected_doc,
                                                       level=MetaInfoScope.node,
                                                       node_name="rally0",
                                                       meta_data=metrics_store_meta_data)
@@ -864,7 +868,8 @@ class NodeStatsRecorderTests(TestCase):
         recorder.record()
 
         metrics_store_put_doc.assert_called_once_with(
-            {"indices_docs_count": 76892364,
+            {"name": "node-stats",
+             "indices_docs_count": 76892364,
              "indices_docs_deleted": 324530,
              "indices_fielddata_evictions": 17,
              "indices_fielddata_memory_size_in_bytes": 6936,