Skip to content

Commit

Permalink
improvement(sdcm/cluster): Store dc and rack information in argus
Browse files Browse the repository at this point in the history
This commit brings updated argus client version that supports storing dc
and rack information, and a change to submit it.

Fixes scylladb/qa-tasks#1657

(cherry picked from commit a7e68c8)
  • Loading branch information
k0machi authored and fruch committed Jan 19, 2025
1 parent 5ae0c5d commit 52bcab0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions sdcm/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ def _add_node_to_argus(self):
resource_type=self.node_type,
public_ip=self.public_ip_address,
private_ip=self.ip_address,
dc_name="",
rack_name="",
region=self.region,
provider=self.parent_cluster.cluster_backend,
shards_amount=shards,
Expand All @@ -405,6 +407,14 @@ def update_shards_in_argus(self):
except Exception: # pylint: disable=broad-except
LOGGER.error("Encountered an unhandled exception while interacting with Argus", exc_info=True)

def update_rack_info_in_argus(self, dc_name: str, rack_name: str):
try:
client = self.test_config.argus_client()
client.update_resource(name=self.name, update_data={"instance_info": {
"rack_name": rack_name, "dc_name": dc_name}})
except Exception: # pylint: disable=broad-except
LOGGER.error("Encountered an unhandled exception while updating resource in Argus", exc_info=True)

def _terminate_node_in_argus(self):
try:
client = self.test_config.argus_client()
Expand Down Expand Up @@ -3807,6 +3817,8 @@ def node_setup(_node: BaseNode, task_queue: queue.Queue):
exception_details = (str(ex), traceback.format_exc())
try:
_node.update_shards_in_argus()
LOGGER.info("DC: %s | Rack: %s", _node.datacenter, _node.node_rack)
_node.update_rack_info_in_argus(_node.datacenter, _node.node_rack)
except Exception: # pylint: disable=broad-except
LOGGER.warning("Failure settings shards for node %s in Argus.", _node)
LOGGER.debug("Exception details:\n", exc_info=True)
Expand Down Expand Up @@ -3890,6 +3902,12 @@ def critical_node_setup_events():
if isinstance(cl_inst, BaseScyllaCluster):
cl_inst.wait_for_nodes_up_and_normal(
nodes=node_list, verification_node=node_list[0], timeout=timeout)
for node in node_list:
try:
node.update_rack_info_in_argus(node.datacenter, node.node_rack)
except Exception: # pylint: disable=broad-except
LOGGER.warning("Failure settings dc/rack infomration for %s in Argus.", node)
LOGGER.debug("Exception details:\n", exc_info=True)

time_elapsed = time.perf_counter() - start_time
cl_inst.log.debug('TestConfig duration -> %s s', int(time_elapsed))
Expand Down

0 comments on commit 52bcab0

Please sign in to comment.