diff --git a/main.star b/main.star index 2ca1076d1..e9a9df41c 100644 --- a/main.star +++ b/main.star @@ -54,6 +54,9 @@ assertoor = import_module("./src/assertoor/assertoor_launcher.star") get_prefunded_accounts = import_module( "./src/prefunded_accounts/get_prefunded_accounts.star" ) +syn_flood = import_module( + "./src/syn_flood.star" +) GRAFANA_USER = "admin" GRAFANA_PASSWORD = "admin" @@ -275,7 +278,7 @@ def run(plan, args={}): service_name=first_client_beacon_name, ) if args_with_right_defaults.mev_type == constants.FLASHBOTS_MEV_TYPE: - endpoint = flashbots_mev_relay.launch_mev_relay( + endpoint, mev_relay_api_prometheus_job, mev_relay_postgres_private_url = flashbots_mev_relay.launch_mev_relay( plan, mev_params, network_id, @@ -286,6 +289,10 @@ def run(plan, args={}): persistent, global_node_selectors, ) + # add prometheus metrics to the list + prometheus_additional_metrics_jobs.append( + mev_relay_api_prometheus_job + ) elif args_with_right_defaults.mev_type == constants.MEV_RS_MEV_TYPE: endpoint, relay_ip_address, relay_port = mev_rs_mev_relay.launch_mev_relay( plan, @@ -625,6 +632,13 @@ def run(plan, args={}): args_with_right_defaults.custom_flood_params, global_node_selectors, ) + elif additional_service == "syn_flood": + plan.print("Launching syn flood tool") + syn_flood.add_syn_flood( + plan, + global_node_selectors, + ) + plan.print("Successfully launched syn flood tool") else: fail("Invalid additional service %s" % (additional_service)) if launch_prometheus_grafana: @@ -646,6 +660,7 @@ def run(plan, args={}): grafana_datasource_config_template, grafana_dashboards_config_template, prometheus_private_url, + mev_relay_postgres_private_url, global_node_selectors, additional_dashboards=args_with_right_defaults.grafana_additional_dashboards, ) diff --git a/network_params.yaml b/network_params.yaml index cd51bb2dc..6c296ed56 100644 --- a/network_params.yaml +++ b/network_params.yaml @@ -14,39 +14,38 @@ participants: el_max_mem: 0 # CL cl_type: lighthouse - cl_image: sigp/lighthouse:latest-unstable - cl_log_level: "" + cl_image: hoprnet/metaclear-lighthouse:c9805b43f + cl_log_level: "debug" cl_extra_env_vars: {} cl_extra_labels: {} - cl_extra_params: [] + cl_extra_params: [] #"--validator-monitor-auto" cl_tolerations: [] cl_volume_size: 0 cl_min_cpu: 0 cl_max_cpu: 0 cl_min_mem: 0 - cl_max_mem: 0 + cl_max_mem: 0 #300 use_separate_vc: true # Validator vc_type: lighthouse - vc_image: sigp/lighthouse:latest-unstable - vc_log_level: "" - vc_count: 1 + vc_image: hoprnet/metaclear-lighthouse:c9805b43f + vc_log_level: "debug" vc_extra_env_vars: {} vc_extra_labels: {} vc_extra_params: [] vc_tolerations: [] vc_min_cpu: 0 - vc_max_cpu: 0 + vc_max_cpu: 0 #200 vc_min_mem: 0 - vc_max_mem: 0 + vc_max_mem: 0 #384 validator_count: null # participant specific node_selectors: {} tolerations: [] count: 2 - snooper_enabled: false - ethereum_metrics_exporter_enabled: false - xatu_sentry_enabled: false + snooper_enabled: true + ethereum_metrics_exporter_enabled: true + xatu_sentry_enabled: true prometheus_config: scrape_interval: 15s labels: {} @@ -84,7 +83,15 @@ network_params: additional_preloaded_contracts: {} devnet_repo: ethpandaops checkpoint_sync_enabled: false -additional_services: [] +additional_services: + - tx_spammer + - blob_spammer + - custom_flood + - el_forkmon + - beacon_metrics_gazer + - dora + - prometheus_grafana + - syn_flood dora_params: image: "" tx_spammer_params: @@ -108,11 +115,11 @@ parallel_keystore_generation: false disable_peer_scoring: false grafana_additional_dashboards: [] persistent: false -mev_type: null +mev_type: flashbots mev_params: - mev_relay_image: flashbots/mev-boost-relay + mev_relay_image: hoprnet/metaclear-mev-relayer:1edd2e6 mev_builder_image: ethpandaops/flashbots-builder:main - mev_builder_cl_image: sigp/lighthouse:latest + mev_builder_cl_image: hoprnet/metaclear-lighthouse:c9805b43f mev_boost_image: flashbots/mev-boost mev_boost_args: ["mev-boost", "--relay-check"] mev_relay_api_extra_args: [] @@ -129,7 +136,7 @@ mev_params: interval_between_transactions: 1 xatu_sentry_enabled: false xatu_sentry_params: - xatu_sentry_image: ethpandaops/xatu-sentry + xatu_sentry_image: ethpandaops/xatu:latest xatu_server_addr: localhost:8000 xatu_server_tls: false xatu_server_headers: {} diff --git a/src/grafana/grafana_launcher.star b/src/grafana/grafana_launcher.star index 12e909e3e..4cedc28bb 100644 --- a/src/grafana/grafana_launcher.star +++ b/src/grafana/grafana_launcher.star @@ -50,6 +50,7 @@ def launch_grafana( datasource_config_template, dashboard_providers_config_template, prometheus_private_url, + mev_relay_postgres_private_url, global_node_selectors, additional_dashboards=[], ): @@ -62,6 +63,7 @@ def launch_grafana( datasource_config_template, dashboard_providers_config_template, prometheus_private_url, + mev_relay_postgres_private_url, additional_dashboards=additional_dashboards, ) @@ -85,9 +87,10 @@ def get_grafana_config_dir_artifact_uuid( datasource_config_template, dashboard_providers_config_template, prometheus_private_url, + mev_relay_postgres_private_url, additional_dashboards=[], ): - datasource_data = new_datasource_config_template_data(prometheus_private_url) + datasource_data = new_datasource_config_template_data(prometheus_private_url, mev_relay_postgres_private_url) datasource_template_and_data = shared_utils.new_template_and_data( datasource_config_template, datasource_data ) @@ -153,8 +156,14 @@ def get_config( ) -def new_datasource_config_template_data(prometheus_url): - return {"PrometheusURL": prometheus_url} +def new_datasource_config_template_data(prometheus_url, postgres_url): + return { + "PrometheusURL": prometheus_url, + "PostgresURL": postgres_url, + "PostgresDatabase": "postgres", + "PostgresUser": "postgres", + "PostgresPassword": "postgres" + } def new_dashboard_providers_config_template_data(dashboards_dirpath): diff --git a/src/mev/flashbots/mev_boost/mev_boost_launcher.star b/src/mev/flashbots/mev_boost/mev_boost_launcher.star index 41b6760b4..7d90c58df 100644 --- a/src/mev/flashbots/mev_boost/mev_boost_launcher.star +++ b/src/mev/flashbots/mev_boost/mev_boost_launcher.star @@ -69,7 +69,8 @@ def get_config( "BOOST_LISTEN_ADDR": "0.0.0.0:{0}".format(input_parser.MEV_BOOST_PORT), # maybe this is breaking; this isn't verifyign the bid and not sending it to the validator "SKIP_RELAY_SIGNATURE_CHECK": "1", - "RELAYS": mev_boost_launcher.relay_end_points[0], + # "RELAYS": mev_boost_launcher.relay_end_points[0], + "RELAYS": ",".join(mev_boost_launcher.relay_end_points), }, min_cpu=MIN_CPU, max_cpu=MAX_CPU, diff --git a/src/mev/flashbots/mev_relay/mev_relay_launcher.star b/src/mev/flashbots/mev_relay/mev_relay_launcher.star index e83d27959..1a001cc96 100644 --- a/src/mev/flashbots/mev_relay/mev_relay_launcher.star +++ b/src/mev/flashbots/mev_relay/mev_relay_launcher.star @@ -1,5 +1,6 @@ redis_module = import_module("github.com/kurtosis-tech/redis-package/main.star") postgres_module = import_module("github.com/kurtosis-tech/postgres-package/main.star") +prometheus = import_module("../../../prometheus/prometheus_launcher.star") constants = import_module("../../../package_io/constants.star") MEV_RELAY_WEBSITE = "mev-relay-website" @@ -8,6 +9,7 @@ MEV_RELAY_HOUSEKEEPER = "mev-relay-housekeeper" MEV_RELAY_ENDPOINT_PORT = 9062 MEV_RELAY_WEBSITE_PORT = 9060 +MEV_RELAY_POSTGRES_PORT = 5432 NETWORK_ID_TO_NAME = { "1": "mainnet", @@ -90,7 +92,7 @@ def launch_mev_relay( redis_url = "{}:{}".format(redis.hostname, redis.port_number) postgres_url = postgres.url + "?sslmode=disable" - plan.add_service( + housekeeper = plan.add_service( name=MEV_RELAY_HOUSEKEEPER, config=ServiceConfig( image=image, @@ -151,6 +153,13 @@ def launch_mev_relay( ), ) + api_prometheus = prometheus.new_metrics_job( + job_name=MEV_RELAY_ENDPOINT, + endpoint="{0}:{1}".format(api.ip_address, MEV_RELAY_ENDPOINT_PORT), + metrics_path="/metrics", + labels={"service": MEV_RELAY_ENDPOINT}, + ) + plan.add_service( name=MEV_RELAY_WEBSITE, config=ServiceConfig( @@ -186,6 +195,11 @@ def launch_mev_relay( ), ) - return "http://{0}@{1}:{2}".format( + mev_relay_endpoint="http://{0}@{1}:{2}".format( constants.DEFAULT_MEV_PUBKEY, api.ip_address, MEV_RELAY_ENDPOINT_PORT ) + + postgres_endpoint="{0}:{1}".format( + postgres.service.ip_address, MEV_RELAY_POSTGRES_PORT + ) + return (mev_relay_endpoint, api_prometheus, postgres_endpoint) diff --git a/src/package_io/constants.star b/src/package_io/constants.star index a19bd6a6f..7e21869cb 100644 --- a/src/package_io/constants.star +++ b/src/package_io/constants.star @@ -82,6 +82,7 @@ MEV_RS_MEV_TYPE = "mev-rs" DEFAULT_SNOOPER_IMAGE = "ethpandaops/rpc-snooper:latest" DEFAULT_FLASHBOTS_RELAY_IMAGE = "flashbots/mev-boost-relay:0.27" +MODIFIED_FLASHBOTS_RELAY_IMAGE = "hoprnet/modified-mev-relayer" DEFAULT_FLASHBOTS_BUILDER_IMAGE = "flashbots/builder:latest" DEFAULT_FLASHBOTS_MEV_BOOST_IMAGE = "flashbots/mev-boost" DEFAULT_MEV_RS_IMAGE = "ethpandaops/mev-rs:main" diff --git a/src/syn_flood.star b/src/syn_flood.star new file mode 100644 index 000000000..61f167176 --- /dev/null +++ b/src/syn_flood.star @@ -0,0 +1,80 @@ +SERVICE_NAME = "syn-flood" + +# The min/max CPU/memory that syn_flood can use +MIN_CPU = 100 +MAX_CPU = 1000 +MIN_MEMORY = 20 +MAX_MEMORY = 1000 + +ENTRYPOINT_ARGS = [ + "sleep", + "99999", +] + + +# def launch_syn_flood( +# plan, +# vitcim_ip, +# syn_flood_extra_args, +# node_selectors, +# ): +# config = get_config( +# vitcim_ip, +# syn_flood_extra_args, +# node_selectors, +# ) + +# plan.add_service(SERVICE_NAME, config) + +# def get_config( +# vitcim_ip, +# syn_flood_extra_args, +# node_selectors, +# ): +# syn_flood_image = "utkudarilmaz/hping3:latest" + +# cmd = [ +# "hping3", +# vitcim_ip, +# ] + +# if len(syn_flood_extra_args) > 0: +# cmd.extend([param for param in syn_flood_extra_args]) + +# return ServiceConfig( +# image=syn_flood_image, +# cmd=cmd, +# min_cpu=MIN_CPU, +# max_cpu=MAX_CPU, +# min_memory=MIN_MEMORY, +# max_memory=MAX_MEMORY, +# node_selectors=node_selectors, +# ) + +def add_syn_flood( + plan, + node_selectors, +): + syn_flood_image = "mik9/hping3:arm64" + + plan.add_service( + SERVICE_NAME, + ServiceConfig( + image=syn_flood_image, + min_cpu=MIN_CPU, + max_cpu=MAX_CPU, + min_memory=MIN_MEMORY, + max_memory=MAX_MEMORY, + node_selectors=node_selectors, + entrypoint=ENTRYPOINT_ARGS, + ), + ) + + # run the command + command_result = plan.exec( + service_name=SERVICE_NAME, + description="Show hping3 version", + recipe=ExecRecipe(command=["hping3", "--version"]), + ) + + return command_result diff --git a/static_files/grafana-config/dashboards/mev-relayer-metrics-dashboard.json b/static_files/grafana-config/dashboards/mev-relayer-metrics-dashboard.json new file mode 100644 index 000000000..b05c8d5ad --- /dev/null +++ b/static_files/grafana-config/dashboards/mev-relayer-metrics-dashboard.json @@ -0,0 +1,1054 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "Relayer metrics", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 3, + "links": [], + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "description": "Link between validators' peer_id and public key by observing attestations", + "fieldConfig": { + "defaults": { + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "peer_id" + }, + "properties": [ + { + "id": "custom.width", + "value": 491 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Time" + }, + "properties": [ + { + "id": "custom.width", + "value": 176 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "pubkey" + }, + "properties": [ + { + "id": "custom.width", + "value": 582 + } + ] + } + ] + }, + "gridPos": { + "h": 11, + "w": 13, + "x": 0, + "y": 0 + }, + "id": 10, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "11.1.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "max(peer_id_to_pubkey) by (peer_id, pubkey)", + "format": "table", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Peer ID and pubkey from attestations", + "transformations": [ + { + "id": "groupBy", + "options": { + "fields": { + "Time": { + "aggregations": [] + }, + "Value": { + "aggregations": [ + "last" + ], + "operation": "aggregate" + }, + "peer_id": { + "aggregations": [], + "operation": "groupby" + }, + "pubkey": { + "aggregations": [], + "operation": "groupby" + } + } + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "description": "Link between validators' public key and multiaddress by observing attestations", + "fieldConfig": { + "defaults": { + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "filterable": false, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "pubkey" + }, + "properties": [] + }, + { + "matcher": { + "id": "byName", + "options": "peer_id" + }, + "properties": [ + { + "id": "custom.width", + "value": 494 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Value" + }, + "properties": [] + } + ] + }, + "gridPos": { + "h": 11, + "w": 13, + "x": 0, + "y": 11 + }, + "id": 11, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "enablePagination": true, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "11.1.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "max(peer_id_to_pubkey) by (pubkey, peer_id)", + "format": "table", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Pubkey and IP from attestations", + "transformations": [ + { + "id": "groupBy", + "options": { + "fields": { + "Value": { + "aggregations": [ + "last" + ], + "operation": "aggregate" + }, + "peer_id": { + "aggregations": [], + "operation": "groupby" + }, + "pubkey": { + "aggregations": [], + "operation": "groupby" + } + } + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "description": "", + "gridPos": { + "h": 4, + "w": 24, + "x": 0, + "y": 22 + }, + "id": 12, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "# Data from Beacon node\n\nFrom a standard lighthouse beacon client, we can collect information like: epoch, headslot, and peer connection on the networking layer.", + "mode": "markdown" + }, + "pluginVersion": "11.1.0", + "title": "Data collected from beacon node", + "type": "text" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 26 + }, + "id": 5, + "panels": [], + "title": "Lighthouse beacon", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "description": "Collect peers and their associated multiaddresses from libp2p layer, extracted from `peer-manager` of `lighthouse_network` crate", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "multiaddress" + }, + "properties": [ + { + "id": "custom.width", + "value": 272 + } + ] + } + ] + }, + "gridPos": { + "h": 11, + "w": 12, + "x": 0, + "y": 27 + }, + "id": 3, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "11.1.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "max(libp2p_peer_to_multiaddr) by (multiaddress, peer_id)", + "format": "table", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Peer ID to multiaddress", + "transformations": [ + { + "id": "groupBy", + "options": { + "fields": { + "multiaddress": { + "aggregations": [], + "operation": "groupby" + }, + "peer_id": { + "aggregations": [], + "operation": "groupby" + } + } + } + }, + { + "id": "organize", + "options": { + "excludeByName": {}, + "includeByName": {}, + "indexByName": { + "multiaddress": 1, + "peer_id": 0 + }, + "renameByName": { + "multiaddress": "Multiaddress", + "peer_id": "Peer ID" + } + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 4, + "x": 12, + "y": 27 + }, + "id": 8, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.1.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "slotclock_present_epoch", + "format": "table", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Current beacon epoch", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 4, + "x": 16, + "y": 27 + }, + "id": 6, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.1.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "beacon_head_slot", + "format": "table", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "{{label_name}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Current head slot", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "PCC52D03280B7034C" + }, + "fieldConfig": { + "defaults": { + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 11, + "w": 12, + "x": 0, + "y": 38 + }, + "id": 7, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "11.1.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "PCC52D03280B7034C" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT slot, (slot/32 + 1) as epoch, validator_index, proposer_pubkey FROM custom_proposer_duties \nORDER BY slot DESC\nLIMIT 64", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "slot", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "validator_index", + "type": "functionParameter" + } + ], + "type": "function" + }, + { + "parameters": [ + { + "name": "proposer_pubkey", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "custom_proposer_duties" + } + ], + "title": "Proposer of the current and next epoches", + "type": "table" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 49 + }, + "id": 4, + "panels": [], + "title": "Relayer", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "description": "Number of http requests per mev-relayer endpoint", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 18, + "w": 9, + "x": 0, + "y": 50 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "maxHeight": 600, + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "disableTextWrap": false, + "editorMode": "code", + "exemplar": false, + "expr": "rate(http_requests_total[1m])", + "format": "time_series", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "{{path}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "MEV-Relayer http endpoint requests", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "PCC52D03280B7034C" + }, + "description": "All the validators registered to the current mev-relayer", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "pubkey" + }, + "properties": [ + { + "id": "custom.width", + "value": 903 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "ip" + }, + "properties": [ + { + "id": "custom.width", + "value": 159 + } + ] + } + ] + }, + "gridPos": { + "h": 18, + "w": 15, + "x": 9, + "y": 50 + }, + "id": 2, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [ + { + "desc": false, + "displayName": "pubkey" + } + ] + }, + "pluginVersion": "11.1.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "PCC52D03280B7034C" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT pubkey, CONCAT(ip, ':', port) AS mev_boost_ip, metadata.inserted_at AS request_timestamp FROM custom_validator_registration validators\nLEFT JOIN\ncustom_metadata metadata\nON metadata.key=validators.pubkey\n\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "ip", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "custom_metadata" + } + ], + "title": "Registered validators", + "transparent": true, + "type": "table" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "PCC52D03280B7034C" + }, + "fieldConfig": { + "defaults": { + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 68 + }, + "id": 9, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [ + { + "desc": true, + "displayName": "epoch" + } + ] + }, + "pluginVersion": "11.1.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "PCC52D03280B7034C" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "WITH validator_metadata AS (\n SELECT pubkey, CONCAT(ip, ':', port) AS mev_boost_ip, metadata.inserted_at AS request_timestamp FROM custom_validator_registration validators\n LEFT JOIN\n custom_metadata metadata\n ON metadata.key=validators.pubkey\n), next_epoch_proposers AS (\n SELECT slot, slot/32 as epoch, validator_index, proposer_pubkey FROM custom_proposer_duties \n ORDER BY slot DESC\n LIMIT 32\n)\n\nSELECT slot, epoch, validator_index, proposer_pubkey, mev_boost_ip FROM next_epoch_proposers\nLEFT JOIN validator_metadata\nON validator_metadata.pubkey = next_epoch_proposers.proposer_pubkey", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Who to attack in the next 12ish min", + "type": "table" + } + ], + "schemaVersion": 39, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "MEV-Relayer", + "uid": "bdptbajsec4jka", + "version": 1, + "weekStart": "" +} diff --git a/static_files/grafana-config/templates/datasource.yml.tmpl b/static_files/grafana-config/templates/datasource.yml.tmpl index a5e27c052..e3c4f4e42 100644 --- a/static_files/grafana-config/templates/datasource.yml.tmpl +++ b/static_files/grafana-config/templates/datasource.yml.tmpl @@ -11,3 +11,17 @@ datasources: basicAuth: false isDefault: true editable: true + - name: PostgreSQL + type: postgres + access: proxy + orgId: 1 + url: {{ .PostgresURL }} # This should be in the format: "hostname:port" + user: {{ .PostgresUser }} + database: {{ .PostgresDatabase }} + secureJsonData: + password: {{ .PostgresPassword }} + jsonData: + sslmode: "disable" + basicAuth: false + isDefault: false + editable: true