Skip to content

Commit

Permalink
fix: fix issue of prometheus service details return as string
Browse files Browse the repository at this point in the history
  • Loading branch information
abhiyana committed Dec 14, 2023
1 parent 11e0251 commit e202f93
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
26 changes: 21 additions & 5 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ def run(plan, args):
"""
Main function to run the Polkadot relay and parachain setup.
Args:
plan (object): The Kurtosis plan object for orchestrating the test.
args (dict): Dictionary containing arguments for configuring the setup.
Returns:
dict: Service details containing information about relay chains, parachains, and Prometheus.
"""
service_details = run_polkadot_setup(plan, args)
return service_details


def run_polkadot_setup(plan, args):
"""
Main function to run the Polkadot relay and parachain setup.
Args:
plan (object): The Kurtosis plan object for orchestrating the test.
args (dict): Dictionary containing arguments for configuring the setup.
Expand All @@ -28,7 +43,6 @@ def run(plan, args):
for key in relay_chain_details:
polkadot_service_name = key
break
plan.print(polkadot_service_name)
service_details.update(relay_chain_details)
parachain_details = parachain.start_nodes(plan, args, relay_chain_details[polkadot_service_name]["ip_address"])
service_details.update(parachain_details)
Expand All @@ -43,14 +57,16 @@ def run(plan, args):
#run prometheus , if it returs some endpoint then grafana will up
prometheus_service_details = promethues.launch_prometheus(plan, args, service_details, prometheus_template)

service_details.update(prometheus_service_details)
if prometheus_service_details["prometheus"]["endpoint"].startswith("http://"):
grafana_service_details = grafana.launch_grafana(plan, grafana)
service_details.update(grafana_service_details)
if len(prometheus_service_details) != 0:
service_details.update(prometheus_service_details)
if prometheus_service_details["prometheus"]["endpoint"].startswith("http://"):
grafana_service_details = grafana.launch_grafana(plan, grafana)
service_details.update(grafana_service_details)

#run the polkadot js App explorer
if args["explorer"] == True:
explorer_service_details = explorer.run_pokadot_js_app(plan, "ws://127.0.0.1:9944")

service_details.update(explorer_service_details)
return service_details

2 changes: 1 addition & 1 deletion package_io/promethues.star
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def launch_prometheus(
)

if len(template_data["MetricsJobs"]) == 0:
return "No Prometheus is available"
return {}

template_and_data = shared_utils.new_template_and_data(
config_template,
Expand Down

0 comments on commit e202f93

Please sign in to comment.