Skip to content

Commit

Permalink
add prometheus
Browse files Browse the repository at this point in the history
  • Loading branch information
minhd-vu committed Mar 19, 2024
1 parent d809975 commit 0c8a838
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 19 deletions.
46 changes: 31 additions & 15 deletions cdk/main.star
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
ethereum_package = import_module(
"github.com/kurtosis-tech/ethereum-package/[email protected]"
)
ethereum_package = import_module("github.com/kurtosis-tech/ethereum-package/[email protected]")
prometheus_package = import_module("github.com/kurtosis-tech/prometheus-package/main.star")

CONTRACTS_IMAGE = "node:20-bookworm"
CONTRACTS_BRANCH = "develop"
Expand Down Expand Up @@ -209,7 +208,7 @@ def run(plan, args):
user=args["zkevm_db_agglayer_user"],
password=args["zkevm_db_agglayer_password"],
)
plan.add_service(
zkevm_agglayer = plan.add_service(
name="zkevm-agglayer" + args["deployment_suffix"],
config=ServiceConfig(
image=args["zkevm_agglayer_image"],
Expand Down Expand Up @@ -246,10 +245,6 @@ def run(plan, args):
image=args["zkevm_dac_image"],
ports={
"dac": PortSpec(args["zkevm_dac_port"], application_protocol="http"),
# Does the DAC have prometheus?!
# "prometheus": PortSpec(
# args["zkevm_prometheus_port"], application_protocol="http"
# ),
},
files={
"/etc/": zkevm_configs,
Expand All @@ -262,7 +257,7 @@ def run(plan, args):
)

# Start synchronizer
plan.add_service(
zkevm_node_synchronizer = plan.add_service(
name="zkevm-node-synchronizer" + args["deployment_suffix"],
config=ServiceConfig(
image=args["zkevm_node_image"],
Expand Down Expand Up @@ -295,7 +290,7 @@ def run(plan, args):
)

# Start sequencer
plan.add_service(
zkevm_node_sequencer = plan.add_service(
name="zkevm-node-sequencer" + args["deployment_suffix"],
config=ServiceConfig(
image=args["zkevm_node_image"],
Expand Down Expand Up @@ -334,7 +329,7 @@ def run(plan, args):
],
),
)
plan.add_service(
zkevm_node_sequencesender = plan.add_service(
name="zkevm-node-sequencesender" + args["deployment_suffix"],
config=ServiceConfig(
image=args["zkevm_node_image"],
Expand Down Expand Up @@ -367,7 +362,7 @@ def run(plan, args):
)

# Start aggregator
plan.add_service(
zkevm_node_aggregator = plan.add_service(
name="zkevm-node-aggregator" + args["deployment_suffix"],
config=ServiceConfig(
image=args["zkevm_node_image"],
Expand Down Expand Up @@ -403,7 +398,7 @@ def run(plan, args):
)

# Start trusted RPC
plan.add_service(
zkevm_node_rpc = plan.add_service(
name="zkevm-node-rpc" + args["deployment_suffix"],
config=ServiceConfig(
image=args["zkevm_node_image"],
Expand Down Expand Up @@ -439,7 +434,7 @@ def run(plan, args):
)

# Start eth-tx-manager and l2-gas-pricer
plan.add_service(
zkevm_node_eth_tx_manager = plan.add_service(
name="zkevm-node-eth-tx-manager" + args["deployment_suffix"],
config=ServiceConfig(
image=args["zkevm_node_image"],
Expand Down Expand Up @@ -470,7 +465,7 @@ def run(plan, args):
],
),
)
plan.add_service(
zkevm_node_l2_gas_pricer = plan.add_service(
name="zkevm-node-l2-gas-pricer" + args["deployment_suffix"],
config=ServiceConfig(
image=args["zkevm_node_image"],
Expand Down Expand Up @@ -525,6 +520,27 @@ def run(plan, args):
),
)

prometheus_services = [
zkevm_agglayer,
zkevm_node_synchronizer,
zkevm_node_sequencer,
zkevm_node_sequencesender,
zkevm_node_aggregator,
zkevm_node_rpc,
zkevm_node_eth_tx_manager,
zkevm_node_l2_gas_pricer
]

metrics_jobs = [{
"Name": service.name,
"Endpoint": "{0}:{1}".format(
service.ip_address,
service.ports["prometheus"].number,
),
} for service in prometheus_services]

prometheus_url = prometheus_package.run(plan, metrics_jobs)


def start_node_databases(plan, args, prover_db_init_script, event_db_init_script):
postgres_port = args["zkevm_db_postgres_port"]
Expand Down
25 changes: 21 additions & 4 deletions permissionless-node/main.star
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
prometheus_package = import_module("github.com/kurtosis-tech/prometheus-package/main.star")

POSTGRES_IMAGE = "postgres:16.2"


Expand All @@ -18,8 +20,23 @@ def run(plan, args):
name="node-config",
config={"node-config.toml": struct(template=node_config_template, data=args)},
)
start_synchronizer(plan, args, node_config_artifact, genesis_artifact)
start_rpc(plan, args, node_config_artifact, genesis_artifact)
synchronizer = start_synchronizer(plan, args, node_config_artifact, genesis_artifact)
rpc = start_rpc(plan, args, node_config_artifact, genesis_artifact)

prometheus_services = [
synchronizer,
rpc,
]

metrics_jobs = [{
"Name": service.name,
"Endpoint": "{0}:{1}".format(
service.ip_address,
service.ports["prometheus"].number,
),
} for service in prometheus_services]

prometheus_url = prometheus_package.run(plan, metrics_jobs)


def determine_cpu_architecture(plan):
Expand Down Expand Up @@ -136,7 +153,7 @@ def start_executor(plan, args, cpu_arch):


def start_synchronizer(plan, args, config_artifact, genesis_artifact):
plan.add_service(
return plan.add_service(
name="zkevm-node-synchronizer" + args["deployment_suffix"],
config=ServiceConfig(
image=args["zkevm_node_image"],
Expand Down Expand Up @@ -170,7 +187,7 @@ def start_synchronizer(plan, args, config_artifact, genesis_artifact):


def start_rpc(plan, args, config_artifact, genesis_artifact):
plan.add_service(
return plan.add_service(
name="zkevm-node-rpc" + args["deployment_suffix"],
config=ServiceConfig(
image=args["zkevm_node_image"],
Expand Down

0 comments on commit 0c8a838

Please sign in to comment.