From 0b262a6c9443bbc1adb78604444101fea89a8341 Mon Sep 17 00:00:00 2001 From: Riya Singh Date: Mon, 27 Nov 2023 14:49:30 +0530 Subject: [PATCH] refactor: service details access in prometheus (#123) * refactor: service details refactored for dive * refactor: removed print statement * merge: resolved merge conflict * refactor: service details access in prometheus --- local.json | 16 ++++++++++------ package_io/promethues.star | 8 ++++---- parachain/static_files/images.star | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/local.json b/local.json index 8c7e0a1..085dd39 100644 --- a/local.json +++ b/local.json @@ -1,17 +1,19 @@ { "chain-type": "local", "relaychain": { - "name": "kusama", + "name": "rococo", "nodes": [ { "name": "alice", "node-type": "validator", - "port": 9944 + "port": 9944, + "prometheus": false }, { "name": "bob", "node-type": "full", - "port": 9945 + "port": 9945, + "prometheus": true } ] }, @@ -21,13 +23,15 @@ "nodes": [ { "name": "alice", - "node-type": "collator" + "node-type": "collator", + "prometheus": true }, { "name": "bob", - "node-type": "full" + "node-type": "full", + "prometheus": false } ] } } -} +} \ No newline at end of file diff --git a/package_io/promethues.star b/package_io/promethues.star index b98bd50..2e35acc 100644 --- a/package_io/promethues.star +++ b/package_io/promethues.star @@ -75,11 +75,11 @@ def new_config_template_data(plan, args, service_details): relay_nodes = args["relaychain"]["nodes"] for node in relay_nodes: if node["prometheus"] == True: - endpoint = "{0}:{1}".format(service_details["relaychains"]["relay_service_{}".format(node["name"])].ip_address, service_details["relaychains"]["relay_service_{}".format(node["name"])].ports["prometheus"].number) + endpoint = "{0}:{1}".format(service_details["relaychains"][0]["service_details"].ip_address, service_details["relaychains"][0]["service_details"].ports["prometheus"].number) metrics_jobs.append( new_metrics_job( - job_name = "relay_service_{}".format(node["name"]), + job_name = service_details["relaychains"][0]["service_name"], endpoint = endpoint, scrape_interval = "5s", ), @@ -89,11 +89,11 @@ def new_config_template_data(plan, args, service_details): for parachain in args["para"]: for node in args["para"][parachain]["nodes"]: if node["prometheus"] == True: - endpoint = "{0}:{1}".format(service_details["parachains"][parachain.lower()]["parachain_{}".format(node["name"])].ip_address, service_details["parachains"][parachain.lower()]["parachain_{}".format(node["name"])].ports["prometheus"].number) + endpoint = "{0}:{1}".format(service_details["parachains"][0]["nodes"][0]["node_details"].ip_address, service_details["parachains"][0]["nodes"][0]["node_details"].ports["prometheus"].number) metrics_jobs.append( new_metrics_job( - job_name = "parachain_{}_{}".format(parachain, node["name"]), + job_name = service_details["parachains"][0]["parachain_name"], endpoint = endpoint, scrape_interval = "5s", ), diff --git a/parachain/static_files/images.star b/parachain/static_files/images.star index f887c87..6cd1736 100644 --- a/parachain/static_files/images.star +++ b/parachain/static_files/images.star @@ -116,7 +116,7 @@ parachain_images = { "base": ["altair-local", "catalyst", "centrifuge"], }, "bajun": { - "image": "ajuna/parachain-bajun:0.1.28", + "image": "ajuna/parachain-bajun:latest", "entrypoint": "/usr/local/bin/ajuna", "base": ["local", "/bajun/rococo/bajun-raw.json", "/bajun/bajun-raw.json"], },