Skip to content

Commit

Permalink
Don't write metrics to a closed metrics store (#877)
Browse files Browse the repository at this point in the history
With this commit we avoid storing any metrics on node shutdown if the
metrics store is closed. This can happen when a node is started and
stopped without any benchmark (with that race id) being run in between.
  • Loading branch information
danielmitterdorfer authored Jan 23, 2020
1 parent 0117188 commit 9edb2fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions esrally/mechanic/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ def stop(self, nodes, metrics_store):
stopped_nodes = []
for node in nodes:
node_name = node.node_name
telemetry.add_metadata_for_node(metrics_store, node_name, node.host_name)
if metrics_store:
telemetry.add_metadata_for_node(metrics_store, node_name, node.host_name)
try:
es = psutil.Process(pid=node.pid)
node.telemetry.detach_from_node(node, running=True)
Expand Down Expand Up @@ -239,5 +240,6 @@ def stop(self, nodes, metrics_store):

node.telemetry.detach_from_node(node, running=False)
# store system metrics in any case (telemetry devices may derive system metrics while the node is running)
node.telemetry.store_system_metrics(node, metrics_store)
if metrics_store:
node.telemetry.store_system_metrics(node, metrics_store)
return stopped_nodes
1 change: 1 addition & 0 deletions esrally/mechanic/mechanic.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def stop(cfg):
logging.getLogger(__name__).info("Could not find race [%s] and will thus not persist system metrics.", race_id)
# Don't persist system metrics if we can't retrieve the race as we cannot derive the required meta-data.
current_race = None
metrics_store = None

node_launcher.stop(nodes, metrics_store)
_delete_node_file(root_path)
Expand Down

0 comments on commit 9edb2fd

Please sign in to comment.