Skip to content
Merged
24 changes: 24 additions & 0 deletions .github/tests/examples/telemetry-events.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
participants:
- cl_type: lighthouse
cl_image: ethpandaops/lighthouse:pq-devnet-1
vc_image: ethpandaops/lighthouse:pq-devnet-1
supernode: true
telemetry_events: [pq]
telemetry_receiver: weaver
- cl_type: prysm
cl_image: ethpandaops/prysm-beacon-chain:pq-devnet-1
vc_image: ethpandaops/prysm-validator:pq-devnet-1
telemetry_events: [pq]
telemetry_receiver: weaver

network_params:
preset: mainnet
gloas_fork_epoch: 0
pq_fork_epoch: 0
aggregation_cutoff_bps: 4000
aggregate_due_bps_pq: 6000
aggregator_delay_bps: 500
genesis_delay: 120

additional_services:
- weaver
71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,54 @@ Common issues:
- `disruptoor_params.config cannot be used together with disruptoor_params.partitions or disruptoor_params.shaping`: use either native Disruptoor state under `config` or the friendly `partitions` / `shaping` fields, not both.
- A partition using only `components: [vc]` fails unless you set `scope` explicitly; the default partition scope is derived from EL/CL P2P traffic.

### Telemetry events example

Clients that implement the [`eth.telemetry` spec](https://github.com/ethDreamer/pq-measurement-spec) export events as OTLP logs when started with `--telemetry-events`. Each participant declares which families it exports (`telemetry_events`) and where they go (`telemetry_receiver`: `weaver`, `xatu_sentry` or an OTLP/gRPC URL); see the participant configuration below.

[`.github/tests/examples/telemetry-events.yaml`](.github/tests/examples/telemetry-events.yaml) sends Lighthouse and Prysm events to the `weaver` additional service, which checks every record against the spec's Weaver registry.

```bash
kurtosis run --enclave telemetry . --args-file .github/tests/examples/telemetry-events.yaml
```

Records, violations and events per emitting process:

```bash
kurtosis service logs -a telemetry weaver | grep -o '{.*' | jq -rs '
def violations: [.. | objects | select(.level? == "violation")] | length;
reduce .[] as $l ({};
if $l.resource then
.cur = ($l.resource.attributes | map({(.name): .value}) | add
| [.["eth.node.id"] // "-", .["service.name"] // "-"] | join(" "))
| .[.cur].violations += ($l | violations)
elif $l.log then
.[.cur].records += 1
| .[.cur].violations += ($l | violations)
| .[.cur].events[$l.log.event_name] += 1
else . end)
| del(.cur)
| ["NODE", "SERVICE", "RECORDS", "VIOLATIONS", "EVENTS"],
(to_entries[] | [(.key | split(" ")), .value.records // 0, .value.violations // 0,
(.value.events // {} | keys | map(ltrimstr("pq.")) | join(","))])
| flatten | @tsv' | column -t -s $'\t'
```

```text
NODE SERVICE RECORDS VIOLATIONS EVENTS
1-lighthouse-geth lighthouse-bn 739 0 aggregate_processed,aggregate_published,aggregate_received,aggregate_traffic,context,duty_completed,duty_scheduled,operation_admitted,operation_completed
2-prysm-geth prysm-bn 779 0 aggregate_processed,aggregate_published,aggregate_received,aggregate_traffic,context,duty_completed,duty_scheduled,operation_admitted,operation_completed
1-lighthouse-geth lighthouse-vc 243 0 context,duty_completed,duty_scheduled
```

Every violation with its event:

```bash
kurtosis service logs -a telemetry weaver | grep -o '{.*' \
| jq -r '.. | objects | select(.level? == "violation") | "\(.signal_name): \(.message)"' | sort | uniq -c
```

`curl -X POST "$(kurtosis port print telemetry weaver admin)/stop"` logs Weaver's own summary (`{"total_entities": ...}`) for the session so far and starts a new one. `not_stable` advisories are expected: every attribute in the registry is `development`.

## Configuration

To configure the package behaviour, you can modify your `network_params.yaml` file. The full YAML schema that can be passed in is as follows with the defaults provided:
Expand Down Expand Up @@ -654,6 +702,22 @@ participants:
# Defaults null and then set to global xatu_sentry_enabled (false)
xatu_sentry_enabled: null

# eth.telemetry event families to export as OTLP logs, e.g. [pq] or [pq, cl]
# Adds --telemetry-events to the beacon node, and to the validator client if it supports it,
# plus OTEL_EXPORTER_OTLP_LOGS_ENDPOINT, OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=grpc and
# OTEL_RESOURCE_ATTRIBUTES=eth.node.id=<index>-<cl_type>-<el_type>; your own env vars win
# Supported: lighthouse and prysm beacon nodes, lighthouse validator client
# Defaults to [] (off)
telemetry_events: []

# Where telemetry_events go; required when they are set
# weaver: the weaver additional service (add weaver to additional_services)
# xatu_sentry: this participant's xatu sentry (needs xatu_sentry_enabled and an image with
# an OTLP receiver, e.g. ethpandaops/xatu:pq-devnet-1)
# or an OTLP/gRPC URL, e.g. http://otel-collector:4317
# Defaults to ""
telemetry_receiver: ""

# Prometheus additional configuration for a given participant prometheus target.
# Execution, beacon and validator client targets on prometheus will include this
# configuration.
Expand Down Expand Up @@ -1191,6 +1255,7 @@ additional_services:
- tracoor
- trueblocks
- tx_fuzz
- weaver

# Configuration place for blockscout explorer - https://github.com/blockscout/blockscout
blockscout_params:
Expand Down Expand Up @@ -1438,6 +1503,12 @@ zkboost_params:
env:
RUST_LOG: "info,zkboost=debug"

# Weaver live-check, the telemetry_receiver for `weaver` in additional_services
weaver_params:
image: otel/weaver:v0.28.0
# Registry to check against: git URL with optional @<ref> and [<sub-folder>], or archive URL
registry: "https://github.com/ethDreamer/pq-measurement-spec.git@90c99625547d6d0d411662acff952350d48068a4[registry]"

# Configuration place for tempo tracing backend
tempo_params:
# Resource management for tempo container
Expand Down
12 changes: 12 additions & 0 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ blockscout = import_module("./src/blockscout/blockscout_launcher.star")
prometheus = import_module("./src/prometheus/prometheus_launcher.star")
grafana = import_module("./src/grafana/grafana_launcher.star")
tempo = import_module("./src/tempo/tempo_launcher.star")
weaver = import_module("./src/weaver/weaver_launcher.star")
commit_boost_mev_boost = import_module(
"./src/mev/commit-boost/mev_boost/mev_boost_launcher.star"
)
Expand Down Expand Up @@ -524,6 +525,15 @@ def run(plan, args={}):
global_node_selectors,
)

if "weaver" in args_with_right_defaults.additional_services:
plan.print("Launching weaver live-check for telemetry events")
weaver.launch_weaver(
plan,
args_with_right_defaults.weaver_params,
global_node_selectors,
global_tolerations,
)

plan.print(
"Launching participant network with {0} participants and the following network params {1}".format(
num_participants, network_params
Expand Down Expand Up @@ -1421,6 +1431,8 @@ def run(plan, args={}):
args_with_right_defaults.docker_cache_params,
)
plan.print("Successfully launched trueblocks")
elif additional_service == "weaver":
plan.print("weaver was launched before the participants")
elif additional_service == "otel":
# Engine OTel reachability is enforced earlier via detect_engine_otel_endpoints();
# if discovery succeeded, the per-client OTLP env vars are already wired.
Expand Down
5 changes: 5 additions & 0 deletions network_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ participants:
snooper_enabled: false
ethereum_metrics_exporter_enabled: false
xatu_sentry_enabled: false
telemetry_events: []
telemetry_receiver: ""
prometheus_config:
scrape_interval: 15s
labels: {}
Expand Down Expand Up @@ -264,6 +266,9 @@ xatu_sentry_params:
- contribution_and_proof
- blob_sidecar
- data_column_sidecar
weaver_params:
image: otel/weaver:v0.28.0
registry: "https://github.com/ethDreamer/pq-measurement-spec.git@90c99625547d6d0d411662acff952350d48068a4[registry]"
nginx_port: 9090
global_tolerations: []
global_node_selectors: {}
Expand Down
10 changes: 10 additions & 0 deletions src/package_io/constants.star
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ DEFAULT_SLASHOOR_IMAGE = "ethpandaops/slashoor:latest"
DEFAULT_ASSERTOOR_IMAGE = "ethpandaops/assertoor:master"
DEFAULT_SNOOPER_IMAGE = "ethpandaops/rpc-snooper:latest"
DEFAULT_BOOTNODOOR_IMAGE = "ethpandaops/bootnodoor:latest"
DEFAULT_WEAVER_IMAGE = "otel/weaver:v0.28.0"
DEFAULT_WEAVER_REGISTRY = "https://github.com/ethDreamer/pq-measurement-spec.git@90c99625547d6d0d411662acff952350d48068a4[registry]"
WEAVER_SERVICE_NAME = "weaver"
WEAVER_OTLP_GRPC_PORT = 4317
WEAVER_ADMIN_PORT = 4320
XATU_SENTRY_OTLP_GRPC_PORT = 4317
TELEMETRY_EVENT_FAMILIES = ["pq", "cl"]
TELEMETRY_RECEIVER = struct(weaver="weaver", xatu_sentry="xatu_sentry")
TELEMETRY_EVENTS_CL_TYPES = [CL_TYPE.lighthouse, CL_TYPE.prysm]
TELEMETRY_EVENTS_VC_TYPES = [VC_TYPE.lighthouse]
DEFAULT_ETHEREUM_GENESIS_GENERATOR_IMAGE = "ethpandaops/ethereum-genesis-generator:pq"
DEFAULT_YQ_IMAGE = "linuxserver/yq"
DEFAULT_FLASHBOTS_RELAY_IMAGE = "ethpandaops/mev-boost-relay:main"
Expand Down
123 changes: 123 additions & 0 deletions src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ ATTR_TO_BE_SKIPPED_AT_ROOT = (
"tx_fuzz_params",
"rakoon_params",
"xatu_sentry_params",
"weaver_params",
"port_publisher",
"spamoor_params",
"disruptoor_params",
Expand Down Expand Up @@ -130,6 +131,7 @@ def input_parser(plan, input_args):
result["prometheus_params"] = get_default_prometheus_params()
result["tempo_params"] = get_default_tempo_params()
result["xatu_sentry_params"] = get_default_xatu_sentry_params()
result["weaver_params"] = get_default_weaver_params()
result["persistent"] = False
result["parallel_keystore_generation"] = False
result["global_tolerations"] = []
Expand Down Expand Up @@ -200,6 +202,10 @@ def input_parser(plan, input_args):
for sub_attr in input_args["xatu_sentry_params"]:
sub_value = input_args["xatu_sentry_params"][sub_attr]
result["xatu_sentry_params"][sub_attr] = sub_value
elif attr == "weaver_params":
for sub_attr in input_args["weaver_params"]:
sub_value = input_args["weaver_params"][sub_attr]
result["weaver_params"][sub_attr] = sub_value
elif attr == "port_publisher":
result["port_publisher"] = get_port_publisher_params("user", input_args)
elif attr == "snooper_params":
Expand Down Expand Up @@ -321,6 +327,15 @@ def input_parser(plan, input_args):
)
)

for index, participant in enumerate(result["participants"]):
if participant["telemetry_events"] or participant["telemetry_receiver"]:
enable_telemetry_events(
participant,
index,
len(result["participants"]),
result["additional_services"],
)

# Per-participant buildoor builders. buildoor is an additional_service: it is
# only spun up when "buildoor" is in additional_services. Its targeting is
# configured (independently of the participants) via buildoor_params.instances
Expand Down Expand Up @@ -879,6 +894,8 @@ def input_parser(plan, input_args):
"ethereum_metrics_exporter_enabled"
],
xatu_sentry_enabled=participant["xatu_sentry_enabled"],
telemetry_events=participant["telemetry_events"],
telemetry_receiver=participant["telemetry_receiver"],
prometheus_config=struct(
scrape_interval=participant["prometheus_config"]["scrape_interval"],
labels=participant["prometheus_config"]["labels"],
Expand Down Expand Up @@ -1240,6 +1257,10 @@ def input_parser(plan, input_args):
beacon_subscriptions=result["xatu_sentry_params"]["beacon_subscriptions"],
xatu_server_tls=result["xatu_sentry_params"]["xatu_server_tls"],
),
weaver_params=struct(
image=result["weaver_params"]["image"],
registry=result["weaver_params"]["registry"],
),
global_tolerations=result["global_tolerations"],
global_node_selectors=result["global_node_selectors"],
keymanager_enabled=result["keymanager_enabled"],
Expand Down Expand Up @@ -2132,6 +2153,8 @@ def default_participant():
"snooper_enabled": None,
"ethereum_metrics_exporter_enabled": None,
"xatu_sentry_enabled": None,
"telemetry_events": [],
"telemetry_receiver": "",
"prometheus_config": {
"scrape_interval": "15s",
"labels": None,
Expand Down Expand Up @@ -2380,6 +2403,13 @@ def get_default_xatu_sentry_params():
}


def get_default_weaver_params():
return {
"image": constants.DEFAULT_WEAVER_IMAGE,
"registry": constants.DEFAULT_WEAVER_REGISTRY,
}


def get_default_snooper_params():
return {
"enabled": False,
Expand Down Expand Up @@ -2808,6 +2838,98 @@ def enrich_mev_extra_params(parsed_arguments_dict, mev_prefix, mev_port, mev_typ
return parsed_arguments_dict


def enable_telemetry_events(participant, index, num_participants, additional_services):
families = participant["telemetry_events"]
if type(families) != "list":
fail(
"telemetry_events of participant {0} must be a list, such as [pq]".format(
index + 1
)
)
if len(families) == 0:
fail(
"telemetry_receiver is set on participant {0}, so set telemetry_events to a non-empty list, such as [pq]".format(
index + 1
)
)
for family in families:
if family not in constants.TELEMETRY_EVENT_FAMILIES:
fail(
"telemetry_events of participant {0} has unknown family {1}, supported families: {2}".format(
index + 1, family, constants.TELEMETRY_EVENT_FAMILIES
)
)
if participant["cl_type"] not in constants.TELEMETRY_EVENTS_CL_TYPES:
fail(
"telemetry_events is set on participant {0}, but its {1} beacon node does not support --telemetry-events; supported cl_type values: {2}".format(
index + 1, participant["cl_type"], constants.TELEMETRY_EVENTS_CL_TYPES
)
)

node_id = shared_utils.get_pair_name(
index, num_participants, participant["cl_type"], participant["el_type"]
)

receiver = participant["telemetry_receiver"]
if receiver == "":
fail(
"telemetry_events is set on participant {0}, so set telemetry_receiver to weaver, xatu_sentry or an OTLP/gRPC URL".format(
index + 1
)
)
elif receiver == constants.TELEMETRY_RECEIVER.weaver:
if constants.TELEMETRY_RECEIVER.weaver not in additional_services:
fail(
"telemetry_receiver of participant {0} is weaver, so add weaver to additional_services".format(
index + 1
)
)
endpoint = "http://{0}:{1}".format(
constants.WEAVER_SERVICE_NAME, constants.WEAVER_OTLP_GRPC_PORT
)
elif receiver == constants.TELEMETRY_RECEIVER.xatu_sentry:
if not participant["xatu_sentry_enabled"]:
fail(
"telemetry_receiver of participant {0} is xatu_sentry, so set xatu_sentry_enabled on it".format(
index + 1
)
)
endpoint = "http://xatu-sentry-{0}:{1}".format(
Comment thread
samcm marked this conversation as resolved.
Resolved
node_id, constants.XATU_SENTRY_OTLP_GRPC_PORT
)
elif receiver.startswith("http://") or receiver.startswith("https://"):
endpoint = receiver
else:
fail(
"telemetry_receiver of participant {0} must be weaver, xatu_sentry or an OTLP/gRPC URL such as http://collector:4317, got '{1}'".format(
index + 1, receiver
)
)

flag = "--telemetry-events=" + ",".join(families)
participant["cl_extra_params"].append(flag)
participant["cl_extra_env_vars"] = with_telemetry_env_vars(
participant["cl_extra_env_vars"], endpoint, node_id
)
if participant["vc_type"] in constants.TELEMETRY_EVENTS_VC_TYPES:
participant["vc_extra_params"].append(flag)
participant["vc_extra_env_vars"] = with_telemetry_env_vars(
participant["vc_extra_env_vars"], endpoint, node_id
)


def with_telemetry_env_vars(env_vars, endpoint, node_id):
merged = dict(env_vars)
merged.setdefault("OTEL_EXPORTER_OTLP_LOGS_ENDPOINT", endpoint)
merged.setdefault("OTEL_EXPORTER_OTLP_LOGS_PROTOCOL", "grpc")
node_attribute = "eth.node.id=" + node_id
existing = merged.get("OTEL_RESOURCE_ATTRIBUTES", "")
merged["OTEL_RESOURCE_ATTRIBUTES"] = (
node_attribute if existing == "" else existing + "," + node_attribute
)
return merged


def deep_copy_participant(participant):
part = {}
for k, v in participant.items():
Expand Down Expand Up @@ -2847,6 +2969,7 @@ def docker_cache_image_override(plan, result):
"mev_params.mev_boost_image",
"mev_params.mock_mev_image",
"xatu_sentry_params.xatu_sentry_image",
"weaver_params.image",
"tx_fuzz_params.image",
"rakoon_params.image",
"prometheus_params.image",
Expand Down
Loading
Loading