Skip to content

Commit

Permalink
fix: fixed service details for mainnet and testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
riyasng12 committed Nov 29, 2023
1 parent 0c73d6c commit 425c9ab
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 24 deletions.
44 changes: 26 additions & 18 deletions package_io/promethues.star
Original file line number Diff line number Diff line change
Expand Up @@ -76,29 +76,37 @@ 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"][0]["service_details"].ip_address, service_details["relaychains"][0]["service_details"].ports["metrics"].number)

metrics_jobs.append(
new_metrics_job(
job_name = service_details["relaychains"][0]["service_name"],
endpoint = endpoint,
scrape_interval = "5s",
),
)
for relay_chain in service_details["relaychains"]:
node_name = relay_chain["service_details"].name
if node_name.endswith(node["name"]):
ip = relay_chain["service_details"].ip_address
port_number = relay_chain["service_details"].ports["metrics"].number
endpoint = "{0}:{1}".format(ip, port_number)
metrics_jobs.append(
new_metrics_job(
job_name = "relay_service_{}".format(node["name"]),
endpoint = endpoint,
scrape_interval = "5s",
),
)
plan.print(node["prometheus"])

for parachain in args["para"]:
for node in parachain["nodes"]:
if node["prometheus"] == True:
endpoint = "{0}:{1}".format(service_details["parachains"][0]["nodes"][0]["node_details"].ip_address, service_details["parachains"][0]["nodes"][0]["node_details"].ports["metrics"].number)

metrics_jobs.append(
new_metrics_job(
job_name = service_details["parachains"][0]["parachain_name"],
endpoint = endpoint,
scrape_interval = "5s",
),
)
for relay_chain in service_details["relaychains"]:
node_name = relay_chain["service_details"].name
if node_name.endswith(node["name"]):
ip = relay_chain["service_details"].ip_address
port_number = relay_chain["service_details"].ports["metrics"].number
endpoint = "{0}:{1}".format(ip, port_number)
metrics_jobs.append(
new_metrics_job(
job_name = "relay_service_{}".format(node["name"]),
endpoint = endpoint,
scrape_interval = "5s",
),
)

return {
"MetricsJobs": metrics_jobs,
Expand Down
16 changes: 11 additions & 5 deletions parachain/parachain.star
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,12 @@ def run_testnet_mainnet(plan, parachain, args):
"--unsafe-ws-external",
]

parachain_info = {parachain["name"]: {}}
if parachain == "altair" or "centrifuge":
common_command = common_command + ["--database=auto"]

final_parachain_info = []
for node in parachain["nodes"]:
parachain_info = {}
command = common_command
command = command + ["--name={0}".format(node["name"])]
if node["node-type"] == "collator":
Expand All @@ -143,12 +144,17 @@ def run_testnet_mainnet(plan, parachain, args):
if parachain["name"] in constant.BINARY_COMMAND_CHAINS:
binary = parachain_details["entrypoint"]
command = [binary] + command

parachain_info["service_name"] = "parachain_service_" + parachain["name"]
parachain_info["parachain_name"] = parachain["name"]
node_details = node_setup.run_testnet_node_with_entrypoint(plan, image, "{0}-{1}-{2}".format(parachain["name"], node["name"], args["chain-type"]), command)
parachain_info[parachain["name"]]["parachain_" + node["name"]] = node_details
parachain_info["nodes"] = node_details
final_parachain_info.append(parachain_info)

else:
parachain_info["service_name"] = "parachain_service_" + parachain["name"]
parachain_info["parachain_name"] = parachain["name"]
node_details = node_setup.run_testnet_node_with_command(plan, image, "{0}-{1}-{2}".format(parachain["name"], node["name"], args["chain-type"]), command)
parachain_info[parachain["name"]]["parachain_" + node["name"]] = node_details
parachain_info["nodes"] = node_details
final_parachain_info.append(parachain_info)

return parachain_info
return final_parachain_info
2 changes: 1 addition & 1 deletion relaychain/relay-chain.star
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def start_relay_chains_local(plan, args):
relay_detail = {}
service_details = start_relay_chain_local(plan, node["name"], node["port"], prometheus_port)
relay_detail["service_details"] = service_details
relay_detail["service_name"] = "relay_service_" + node["name"]
relay_detail["service_name"] = service_details.name
final_details.append(relay_detail)
prometheus_port = prometheus_port + 1
return final_details
Expand Down

0 comments on commit 425c9ab

Please sign in to comment.