diff --git a/esrally/telemetry.py b/esrally/telemetry.py index e92ae31f8..ce151e979 100644 --- a/esrally/telemetry.py +++ b/esrally/telemetry.py @@ -829,7 +829,8 @@ def record(self): current_sample = self.sample() for node_stats in current_sample: node_name = node_stats["name"] - metrics_store_meta_data = {"cluster": self.cluster_name, "node_name": node_name} + roles = node_stats["roles"] + metrics_store_meta_data = {"cluster": self.cluster_name, "node_name": node_name, "roles": roles} collected_node_stats = collections.OrderedDict() collected_node_stats["name"] = "node-stats" diff --git a/tests/telemetry_test.py b/tests/telemetry_test.py index 5d5b021e5..bc4f55226 100644 --- a/tests/telemetry_test.py +++ b/tests/telemetry_test.py @@ -2145,13 +2145,15 @@ def test_stores_default_nodes_stats(self, metrics_store_put_doc): client = Client(nodes=SubClient(stats=self.node_stats_response)) cfg = create_config() metrics_store = metrics.EsMetricsStore(cfg) - node_name = [self.node_stats_response["nodes"][node]["name"] for node in self.node_stats_response["nodes"]][0] - metrics_store_meta_data = {"cluster": "remote", "node_name": node_name} telemetry_params = {} recorder = telemetry.NodeStatsRecorder(telemetry_params, cluster_name="remote", client=client, metrics_store=metrics_store) recorder.record() + node_name = [self.node_stats_response["nodes"][node]["name"] for node in self.node_stats_response["nodes"]][0] + roles = [self.node_stats_response["nodes"][node]["roles"] for node in self.node_stats_response["nodes"]][0] + metrics_store_meta_data = {"cluster": "remote", "node_name": node_name, "roles": roles} + expected_doc = collections.OrderedDict() expected_doc["name"] = "node-stats" expected_doc.update(self.default_stats_response_flattened) @@ -2395,12 +2397,14 @@ def test_stores_all_nodes_stats(self, metrics_store_put_doc): client = Client(nodes=SubClient(stats=node_stats_response)) cfg = create_config() metrics_store = metrics.EsMetricsStore(cfg) - node_name = [node_stats_response["nodes"][node]["name"] for node in node_stats_response["nodes"]][0] - metrics_store_meta_data = {"cluster": "remote", "node_name": node_name} telemetry_params = {"node-stats-include-indices": True} recorder = telemetry.NodeStatsRecorder(telemetry_params, cluster_name="remote", client=client, metrics_store=metrics_store) recorder.record() + node_name = [node_stats_response["nodes"][node]["name"] for node in node_stats_response["nodes"]][0] + roles = [node_stats_response["nodes"][node]["roles"] for node in node_stats_response["nodes"]][0] + metrics_store_meta_data = {"cluster": "remote", "node_name": node_name, "roles": roles} + metrics_store_put_doc.assert_called_once_with( { "name": "node-stats", @@ -2731,12 +2735,14 @@ def test_stores_selected_indices_metrics_from_nodes_stats(self, metrics_store_pu client = Client(nodes=SubClient(stats=node_stats_response)) cfg = create_config() metrics_store = metrics.EsMetricsStore(cfg) - node_name = [node_stats_response["nodes"][node]["name"] for node in node_stats_response["nodes"]][0] - metrics_store_meta_data = {"cluster": "remote", "node_name": node_name} telemetry_params = {"node-stats-include-indices-metrics": "refresh,docs"} recorder = telemetry.NodeStatsRecorder(telemetry_params, cluster_name="remote", client=client, metrics_store=metrics_store) recorder.record() + node_name = [node_stats_response["nodes"][node]["name"] for node in node_stats_response["nodes"]][0] + roles = [node_stats_response["nodes"][node]["roles"] for node in node_stats_response["nodes"]][0] + metrics_store_meta_data = {"cluster": "remote", "node_name": node_name, "roles": roles} + metrics_store_put_doc.assert_called_once_with( { "name": "node-stats",