crates/aptos-telemetry-service/e2e-test/test-client/README.md
A CLI tool to test the Aptos Telemetry Service custom contract endpoints.
cd /path/to/aptos-core
cargo build -p telemetry-test-client
| Variable | Description | Default |
|---|---|---|
TELEMETRY_SERVICE_URL | Base URL of the telemetry service | http://localhost:8082 |
CONTRACT_NAME | Custom contract name to use | e2e_test_contract |
PRIVATE_KEY_HEX | Private key for signing (hex, with or without 0x) | Random |
CHAIN_ID | Chain ID | 4 |
# Get a JWT token
cargo run -p telemetry-test-client -- auth
# With specific key
cargo run -p telemetry-test-client -- -p 0x1234...abcd auth
# Send sample metrics
cargo run -p telemetry-test-client -- metrics
# Send metrics from file
cargo run -p telemetry-test-client -- metrics -f /path/to/metrics.prom
# Custom sample metric
cargo run -p telemetry-test-client -- metrics --metric-name my_metric --metric-value 100
# Send sample logs
cargo run -p telemetry-test-client -- logs
# Send logs from file (JSON array of strings)
cargo run -p telemetry-test-client -- logs -f /path/to/logs.json
# Custom sample logs
cargo run -p telemetry-test-client -- logs --message "Hello World" --count 5
# Send sample events
cargo run -p telemetry-test-client -- events
# Send events from file (TelemetryDump JSON format)
cargo run -p telemetry-test-client -- events -f /path/to/events.json
# Custom event name
cargo run -p telemetry-test-client -- events --event-name MY_CUSTOM_EVENT
# Send all types once
cargo run -p telemetry-test-client -- all
# Send all types with 10 iterations, 2 second delay
cargo run -p telemetry-test-client -- all -i 10 -d 2
# Source the test environment
source /path/to/aptos-core/crates/aptos-telemetry-service/e2e-test/test-data/.env
# Run with the test account key
cargo run -p telemetry-test-client -- \
-u http://localhost:8082 \
-c e2e_test_contract \
-p $TEST_ACCOUNT_KEY_HEX \
--chain-id 4 \
all -i 5 -d 1
# HELP my_metric A sample metric
# TYPE my_metric gauge
my_metric{label="value"} 42.0 1701234567890
[
"{\"level\":\"INFO\",\"message\":\"Log 1\"}",
"{\"level\":\"WARN\",\"message\":\"Log 2\"}"
]
{
"client_id": "my-client",
"user_id": "0x123...",
"timestamp_micros": "1701234567890000",
"events": [
{
"name": "MY_EVENT",
"params": {
"key1": "value1"
}
}
]
}