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
256 changes: 256 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,238 @@ 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 examples

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 the families it exports (`telemetry_events`) and where they go (`telemetry_receiver`). Today that means the `pq-devnet-1` Lighthouse and Prysm images on a pq-fork network:

```yaml
network_params:
preset: mainnet
gloas_fork_epoch: 0
pq_fork_epoch: 0
```

The examples below show only the `participants` and services; add the `network_params` above. Each opted-in beacon node, and its validator client if it takes the flag, gets `--telemetry-events=<families>`, `eth.node.id=<index>-<cl_type>-<el_type>` (shared by a beacon node and its validator client) and `OTEL_SERVICE_NAME=<kurtosis service name>`.

#### Check events against the spec with Weaver

```yaml
participants:
- cl_type: lighthouse
cl_image: ethpandaops/lighthouse:pq-devnet-1
vc_image: ethpandaops/lighthouse:pq-devnet-1
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
additional_services:
- weaver
```

This is [`.github/tests/examples/telemetry-events.yaml`](.github/tests/examples/telemetry-events.yaml):

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

The `weaver` service runs `weaver registry live-check` and logs one JSON line per record with its findings. This shell function prints, for every opted-in service that sends to `weaver`, how many of each registry event Weaver received and how many violations it found. A `-` is an event that service never sent, so a silent client or an event a client hasn't implemented stands out:

```bash
telemetry_summary() {
local enclave=${1:-telemetry}
local expected
expected=$(kurtosis enclave inspect "$enclave" | awk '$2 ~ /^(cl|vc)-/ {print $2}' | while read -r service; do
kurtosis service inspect "$enclave" "$service" -o json | jq -c --arg service "$service" '
select(.env_vars.OTEL_EXPORTER_OTLP_LOGS_ENDPOINT // "" | startswith("http://weaver:"))
| {service: $service, families: ([(.entrypoint, .cmd) | tostring | scan("--telemetry-events=([a-z,]+)")[0]][0] // "pq" | split(","))}'
done | jq -s .)
kurtosis service logs -a "$enclave" weaver | grep -o '{.*' | jq -rs --argjson expected "$expected" '
def violations: [.. | objects | select(.level? == "violation")] | length;
{
pq: ["pq.context", "pq.aggregate_received", "pq.aggregate_processed", "pq.aggregate_published",
"pq.validation_batch", "pq.operation_admitted", "pq.operation_completed",
"pq.duty_scheduled", "pq.duty_completed", "pq.aggregate_traffic"],
cl: ["eth.cl.context", "eth.cl.object_published", "eth.cl.object_received", "eth.cl.object_processed"]
} as $registry
| (reduce .[] as $l ({};
if $l.resource then
.cur = ([$l.resource.attributes[] | select(.name == "service.name") | .value][0] // "?")
| .[.cur].violations += ($l | violations)
elif $l.log then
.[.cur].events[$l.log.event_name] += 1
| .[.cur].violations += ($l | violations)
else . end) | del(.cur)) as $seen
| ($expected | map(.service)) as $expected_services
| ($expected_services + (($seen | keys) - $expected_services)) as $columns
| ([$registry[($expected | map(.families[]) | unique | if . == [] then ["pq"] else . end)[]][]]) as $listed
| ($listed + (([$seen[].events // {} | keys[]] | unique) - $listed)) as $rows
| (["EVENT"] + $columns),
($rows[] as $event | [$event] + [$columns[] | ($seen[.].events[$event] // 0) | if . == 0 then "-" else tostring end]),
(["VIOLATIONS"] + [$columns[] | ($seen[.].violations // 0) | tostring])
| @tsv' | column -t -s $'\t'
}

telemetry_summary telemetry
```

In this run a third Lighthouse participant had its validator client pointed at a wrong port, so `vc-3-geth-lighthouse` sent nothing. No client emits `pq.validation_batch`, which only applies to batched validation. `vc-2-geth-prysm` is not listed because the Prysm validator client does not take `--telemetry-events`:

```text
EVENT cl-1-lighthouse-geth cl-2-prysm-geth cl-3-lighthouse-geth vc-1-geth-lighthouse vc-3-geth-lighthouse
pq.context 1 1 1 1 -
pq.aggregate_received 9 6 13 - -
pq.aggregate_processed 9 6 13 - -
pq.aggregate_published 5 8 1 - -
pq.validation_batch - - - - -
pq.operation_admitted 14 11 12 - -
pq.operation_completed 14 11 12 - -
pq.duty_scheduled 23 83 1 92 -
pq.duty_completed 24 23 14 1 -
pq.aggregate_traffic 307 183 301 - -
VIOLATIONS 0 0 0 0 0
```

Each 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
```

```text
1 pq.context: Required attribute 'eth.telemetry.event_seq' is not present.
```

Weaver's own summary for the session so far. `/stop` writes it to the logs and the service starts a new session:

```bash
curl -X POST "$(kurtosis port print telemetry weaver admin)/stop"
kurtosis service logs -a telemetry weaver | grep -o '{"total_entities.*' | tail -1 \
| jq '{advice_level_counts, registry_coverage, seen_registry_events}'
```

```json
{
"advice_level_counts": {
"information": 6475,
"improvement": 56169
},
"registry_coverage": 0.6503497,
"seen_registry_events": {
"pq.aggregate_traffic": 2595,
"pq.aggregate_received": 135,
"pq.context": 3,
"eth.cl.object_processed": 0,
"pq.duty_completed": 342,
"pq.operation_admitted": 199,
"pq.operation_completed": 199,
"pq.validation_batch": 0,
"pq.duty_scheduled": 500,
"pq.aggregate_published": 73,
"eth.cl.object_published": 0,
"eth.cl.context": 0,
"pq.aggregate_processed": 135,
"eth.cl.object_received": 0
}
}
```

`not_stable` advisories are expected: every attribute in the registry is `development`.

#### Check against your own registry changes

Point Weaver at a fork, branch or commit of the spec registry (`<repo>.git@<ref>[<folder>]`):

```yaml
weaver_params:
registry: "https://github.com/<you>/pq-measurement-spec.git@my-branch[registry]"
```

#### Send events to a xatu sentry

The participant's own sentry receives the events and ships them to its Xatu server. The sentry image needs the OTLP receiver:

```yaml
participants:
- cl_type: prysm
cl_image: ethpandaops/prysm-beacon-chain:pq-devnet-1
vc_image: ethpandaops/prysm-validator:pq-devnet-1
xatu_sentry_enabled: true
telemetry_events: [pq]
telemetry_receiver: xatu_sentry
xatu_sentry_params:
xatu_sentry_image: ethpandaops/xatu:pq-devnet-1
xatu_server_addr: xatu.example.com:443
xatu_server_tls: true
```

Records the sentry accepted:

```bash
curl -s "$(kurtosis port print telemetry xatu-sentry-1-prysm-geth http)/metrics" | grep otlp_log_records_total
```

```text
xatu_sentry_otlp_log_records_total{event_name="pq.aggregate_processed",result="admitted"} 34
xatu_sentry_otlp_log_records_total{event_name="pq.aggregate_published",result="admitted"} 19
xatu_sentry_otlp_log_records_total{event_name="pq.aggregate_received",result="admitted"} 34
xatu_sentry_otlp_log_records_total{event_name="pq.aggregate_traffic",result="admitted"} 648
xatu_sentry_otlp_log_records_total{event_name="pq.context",result="admitted"} 1
xatu_sentry_otlp_log_records_total{event_name="pq.duty_completed",result="admitted"} 86
xatu_sentry_otlp_log_records_total{event_name="pq.duty_scheduled",result="admitted"} 163
xatu_sentry_otlp_log_records_total{event_name="pq.operation_admitted",result="admitted"} 36
xatu_sentry_otlp_log_records_total{event_name="pq.operation_completed",result="admitted"} 36
```

#### Send events to any OTLP collector

Any OTLP/gRPC endpoint reachable from the enclave works, and the receivers can be mixed per participant:

```yaml
participants:
- cl_type: lighthouse
cl_image: ethpandaops/lighthouse:pq-devnet-1
vc_image: ethpandaops/lighthouse:pq-devnet-1
telemetry_events: [pq]
telemetry_receiver: http://otel-collector.example.com:4317
cl_extra_env_vars:
OTEL_RESOURCE_ATTRIBUTES: deployment.environment=local
- cl_type: lighthouse
cl_image: ethpandaops/lighthouse:pq-devnet-1
vc_image: ethpandaops/lighthouse:pq-devnet-1
telemetry_events: [pq]
telemetry_receiver: weaver
- cl_type: lighthouse
cl_image: ethpandaops/lighthouse:pq-devnet-1
vc_image: ethpandaops/lighthouse:pq-devnet-1
additional_services:
- weaver
```

Your own `OTEL_*` values in `cl_extra_env_vars` / `vc_extra_env_vars` win, and `OTEL_RESOURCE_ATTRIBUTES` is appended to; the first beacon node above exports with `deployment.environment=local,eth.node.id=1-lighthouse-geth`. The third participant is not changed.

#### Run Weaver without Kurtosis

For a client running on your machine, use the same pinned Weaver and registry:

```bash
docker run --rm -p 4317:4317 -p 4320:4320 otel/weaver:v0.28.0 registry live-check \
-r 'https://github.com/ethDreamer/pq-measurement-spec.git@90c99625547d6d0d411662acff952350d48068a4[registry]' \
--otlp-grpc-address 0.0.0.0 --otlp-grpc-port 4317 --admin-port 4320 --inactivity-timeout 0

OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=http://127.0.0.1:4317 \
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=grpc \
OTEL_RESOURCE_ATTRIBUTES=eth.node.id=my-node \
lighthouse bn ... --telemetry-events=pq

curl -X POST localhost:4320/stop
```

`/stop` prints the summary and exits with status 1 if any record had a violation.

## 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 +886,23 @@ 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,
# OTEL_RESOURCE_ATTRIBUTES=eth.node.id=<index>-<cl_type>-<el_type> and
# OTEL_SERVICE_NAME=<kurtosis service name>; 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 +1440,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 +1688,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
7 changes: 3 additions & 4 deletions src/cl/cl_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,9 @@ def launch(
index + 1, len(str(len(args_with_right_defaults.participants)))
)

if el_type == constants.EL_TYPE.none:
cl_service_name = "cl-{0}-{1}".format(index_str, cl_type)
else:
cl_service_name = "cl-{0}-{1}-{2}".format(index_str, cl_type, el_type)
cl_service_name = "cl-" + shared_utils.get_pair_name(
index, len(args_with_right_defaults.participants), cl_type, el_type
)
new_cl_node_validator_keystores = None
if participant.validator_count != 0:
new_cl_node_validator_keystores = preregistered_validator_keys_for_nodes[
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
Loading
Loading