Skip to content

Commit

Permalink
Merge pull request #7 from chainbound/lore/feat/metrics
Browse files Browse the repository at this point in the history
Feat: prometheus and sidecar integration for the sidecar
  • Loading branch information
thedevbirb authored Sep 2, 2024
2 parents d3e6dcc + 133a3f0 commit b36207f
Show file tree
Hide file tree
Showing 5 changed files with 869 additions and 4 deletions.
8 changes: 7 additions & 1 deletion main.star
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ def run(plan, args={}):
)
)

mev_sidecar_context=struct(
ip_addr="",
metrics_port_num=0,
)
all_el_contexts = []
all_cl_contexts = []
all_vc_contexts = []
Expand Down Expand Up @@ -285,7 +289,7 @@ def run(plan, args={}):
all_mevboost_contexts.append(mev_boost_context)

# add mev-sidecar
mev_sidecar.launch_mev_sidecar(
mev_sidecar_ctx = mev_sidecar.launch_mev_sidecar(
plan,
mev_params,
global_node_selectors,
Expand All @@ -302,6 +306,7 @@ def run(plan, args={}):
raw_jwt_secret,
network_params.seconds_per_slot
)
mev_sidecar_context = mev_sidecar_ctx

if len(args_with_right_defaults.additional_services) == 0:
output = struct(
Expand Down Expand Up @@ -471,6 +476,7 @@ def run(plan, args={}):
all_ethereum_metrics_exporter_contexts,
all_xatu_sentry_contexts,
global_node_selectors,
mev_sidecar_context,
)

plan.print("Launching grafana...")
Expand Down
11 changes: 9 additions & 2 deletions src/mev/mev_sidecar/mev_sidecar_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ MEV_SIDECAR_ENDPOINT = "mev-sidecar-api"

MEV_SIDECAR_ENDPOINT_PORT = 9061
MEV_SIDECAR_BOOST_PROXY_PORT = 9062
MEV_SIDECAR_METRICS_PORT = 9063

# The min/max CPU/memory that mev-sidecar can use
MEV_SIDECAR_MIN_CPU = 100
Expand Down Expand Up @@ -63,6 +64,8 @@ def launch_mev_sidecar(
"0..64",
"--slot-time",
str(seconds_per_slot),
"--metrics-port",
str(MEV_SIDECAR_METRICS_PORT),
],
# + mev_params.mev_relay_api_extra_args,
ports={
Expand All @@ -72,6 +75,9 @@ def launch_mev_sidecar(
"mevboost-proxy": PortSpec(
number=MEV_SIDECAR_BOOST_PROXY_PORT, transport_protocol="TCP"
),
"metrics": PortSpec(
number=MEV_SIDECAR_METRICS_PORT, transport_protocol="TCP"
),
},
env_vars=env_vars,
min_cpu=MEV_SIDECAR_MIN_CPU,
Expand All @@ -82,6 +88,7 @@ def launch_mev_sidecar(
),
)

return "http://{0}:{1}".format(
api.ip_address, MEV_SIDECAR_ENDPOINT_PORT
return struct(
ip_addr=api.ip_address,
metrics_port_num=MEV_SIDECAR_METRICS_PORT,
)
1 change: 0 additions & 1 deletion src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,6 @@ def enrich_mev_extra_params(parsed_arguments_dict, mev_prefix, mev_port, mev_typ
"el_extra_params": [
"--builder",
"--builder.remote_relay_endpoint=http://mev-relay-api:9062",
"--builder.mev_sidecar_endpoint=http://mev-sidecar-api:9061",
"--builder.beacon_endpoints=http://cl-{0}-lighthouse-geth-builder:4000".format(
index_str
),
Expand Down
17 changes: 17 additions & 0 deletions src/prometheus/prometheus_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def launch_prometheus(
ethereum_metrics_exporter_contexts,
xatu_sentry_contexts,
global_node_selectors,
mev_sidecar_context,
):
metrics_jobs = get_metrics_jobs(
el_contexts,
Expand All @@ -36,6 +37,7 @@ def launch_prometheus(
additional_metrics_jobs,
ethereum_metrics_exporter_contexts,
xatu_sentry_contexts,
mev_sidecar_context,
)
prometheus_url = prometheus.run(
plan,
Expand All @@ -58,6 +60,7 @@ def get_metrics_jobs(
additional_metrics_jobs,
ethereum_metrics_exporter_contexts,
xatu_sentry_contexts,
mev_sidecar_context,
):
metrics_jobs = []
# Adding execution clients metrics jobs
Expand Down Expand Up @@ -187,6 +190,20 @@ def get_metrics_jobs(
continue
metrics_jobs.append(job)

# Adding mev-sidecar metrics job
if mev_sidecar_context != None:
metrics_jobs.append(
new_metrics_job(
job_name="mev-sidecar",
endpoint="{}:{}".format(
mev_sidecar_context.ip_addr,
mev_sidecar_context.metrics_port_num,
),
metrics_path="/metrics",
labels={},
)
)

return metrics_jobs


Expand Down
Loading

0 comments on commit b36207f

Please sign in to comment.