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

Participants can export [`eth.telemetry`](https://github.com/ethDreamer/pq-measurement-spec) events with `telemetry_events` and `telemetry_receiver`, and the `weaver` additional service checks them against the spec. See [docs/telemetry-events.md](./docs/telemetry-events.md).

## 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 +658,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 +1212,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 +1460,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
131 changes: 131 additions & 0 deletions docs/telemetry-events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Telemetry events

Clients that implement the [`eth.telemetry` spec](https://github.com/ethDreamer/pq-measurement-spec) export measurement events as OTLP logs when started with `--telemetry-events`. Today those are the `pq-devnet-1` Lighthouse and Prysm images, which need a pq-fork network (`pq_fork_epoch: 0`).

## Configuration

```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
additional_services:
- weaver
```

`telemetry_receiver` is one of:

- `weaver`: the `weaver` additional service, which checks every record against the spec's registry with [Weaver](https://github.com/open-telemetry/weaver) `registry live-check`.
- `xatu_sentry`: the participant's own xatu sentry. Needs `xatu_sentry_enabled` and an image with the OTLP receiver (`xatu_sentry_params.xatu_sentry_image: ethpandaops/xatu:pq-devnet-1`).
- An OTLP/gRPC URL, such as `http://otel-collector:4317`.

The beacon node, and the validator client if it takes the flag, get `--telemetry-events`, the `OTEL_EXPORTER_OTLP_LOGS_*` settings, `eth.node.id=<index>-<cl_type>-<el_type>` and `OTEL_SERVICE_NAME=<kurtosis service name>`. Your own values in `cl_extra_env_vars` / `vc_extra_env_vars` win.

## Checking a different spec version

Weaver checks against the registry in `weaver_params.registry`, a git URL with `@<branch, tag or commit>` and the registry folder in `[...]`. The default is pinned to a commit. To test a client that implements newer events, point it at that version of the spec and enable the families the client supports:

```yaml
participants:
- cl_type: lighthouse
cl_image: <image with pq and cl events>
vc_image: <image with pq and cl events>
telemetry_events: [pq, cl]
telemetry_receiver: weaver
additional_services:
- weaver
weaver_params:
registry: "https://github.com/ethDreamer/pq-measurement-spec.git@main[registry]"
```

A fork or an unmerged branch works the same way: `https://github.com/<you>/pq-measurement-spec.git@<branch>[registry]`. A branch is resolved when the `weaver` service starts. `telemetry_summary` below takes its rows from that registry, so new events show up without changing it. A client that doesn't support a family in `telemetry_events` exits at startup.

[`.github/tests/examples/telemetry-events.yaml`](../.github/tests/examples/telemetry-events.yaml) runs Lighthouse and Prysm against Weaver.

## Reading the results

`telemetry_summary <enclave>` shows how many of each event every opted-in service sent to Weaver. The rows are the events of the opted-in families in the registry the `weaver` service checks against, resolved inside that service. A `-` is an event that service never sent:

```bash
telemetry_summary() {
local enclave=${1:-telemetry}
local expected registry events
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 .)
registry=$(kurtosis service inspect "$enclave" weaver -o json | jq -r '.cmd | tostring | [scan("--registry '"'"'([^'"'"']+)'"'"'")[0]][0]')
events=$(kurtosis service exec "$enclave" weaver \
"/weaver/weaver registry resolve --quiet -r '$registry' -f json -o /tmp/registry.json >/dev/null 2>&1; cat /tmp/registry.json" 2>/dev/null \
| jq -c '[.groups[] | select(.type == "event") | .name]')
kurtosis service logs -a "$enclave" weaver | grep -o '{.*' | jq -rs --argjson expected "$expected" --argjson registry "$events" '
def violations: [.. | objects | select(.level? == "violation")] | length;
(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(.families[]) | unique) as $families
| ($registry | map(select((split(".") | if .[0] == "eth" then .[1] else .[0] end) as $f | $families | index($f)))) as $listed
| ($listed + (([$seen[].events // {} | keys[]] | unique) - $listed)) as $rows
| ($expected | map(.service)) as $expected_services
| ($expected_services + (($seen | keys) - $expected_services)) as $columns
| (["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'
}
```

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

To list the violations:

```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"` writes Weaver's own summary to its logs and starts a new session. `not_stable` advisories are expected, because the registry marks every attribute `development`.

For `xatu_sentry`, the sentry's metrics count what it received:

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

## Without Kurtosis

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