Skip to content
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

Add role metadata to node-stats telemetry device #1654

Merged
merged 3 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion esrally/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
18 changes: 12 additions & 6 deletions tests/telemetry_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down