Fix write-check by disabling verification by default, since it isn't working yet. Also add tests
This commit is contained in:
@@ -7,6 +7,7 @@ Production-oriented Prometheus exporter for monitoring a fixed set of Nostr rela
|
||||
- Probes each configured relay either on an interval, or on-demand when `/metrics` is scraped.
|
||||
- Uses `@nostrwatch/nocap` for `open` + `read` checks.
|
||||
- Optionally performs a low-noise write confirmation check (kind `30078` by default) using deterministic `d` tags.
|
||||
- By default, treats relay `OK` for publish as success; optional read-after-write verification can be enabled.
|
||||
- Exposes:
|
||||
- `/metrics` for Prometheus scraping
|
||||
- `/healthz` for process and probe-loop health
|
||||
@@ -48,6 +49,7 @@ Environment variables:
|
||||
- `PORT` (default: `9464`)
|
||||
- `LOG_LEVEL` (default: `info`; one of `debug|info|warn|error`)
|
||||
- `WRITE_CHECK_ENABLED` (default: `true`)
|
||||
- `WRITE_CHECK_VERIFY_READ` (default: `false`; when `true`, require event read-back after publish)
|
||||
- `WRITE_CHECK_KIND` (default: `30078`)
|
||||
- `WRITE_CHECK_PRIVKEY` (optional; supports `nsec1...` or 64-char hex)
|
||||
|
||||
@@ -79,6 +81,34 @@ Run tests:
|
||||
pnpm test
|
||||
```
|
||||
|
||||
Run the live write-confirm diagnostic for `offchain.pub` (opt-in):
|
||||
|
||||
```bash
|
||||
LIVE_RELAY_TEST_OFFCHAIN=1 \
|
||||
LIVE_RELAY_TEST_RELAYS="wss://offchain.pub" \
|
||||
pnpm test test/live.offchain.test.ts
|
||||
```
|
||||
|
||||
Full example with write verification enabled:
|
||||
|
||||
```bash
|
||||
LIVE_RELAY_TEST_OFFCHAIN=1 \
|
||||
LIVE_RELAY_TEST_RELAYS="wss://offchain.pub" \
|
||||
LIVE_RELAY_TEST_WRITE_VERIFY_READ=1 \
|
||||
LIVE_RELAY_TEST_TIMEOUT_SECONDS=8 \
|
||||
LIVE_RELAY_TEST_EXPECT_NO_FAILURES=1 \
|
||||
pnpm test test/live.offchain.test.ts
|
||||
```
|
||||
|
||||
Optional knobs:
|
||||
|
||||
- `LIVE_RELAY_TEST_SAMPLES` (default `12`)
|
||||
- `LIVE_RELAY_TEST_SCRAPE_EVERY_MS` (default `1500`)
|
||||
- `LIVE_RELAY_TEST_TIMEOUT_SECONDS` (default `8`)
|
||||
- `LIVE_RELAY_TEST_RELAYS` (default `"wss://offchain.pub"`; comma-separated relay list)
|
||||
- `LIVE_RELAY_TEST_WRITE_VERIFY_READ=1` to enable read-after-write verification (disabled by default)
|
||||
- `LIVE_RELAY_TEST_EXPECT_NO_FAILURES=1` to make the test fail on any write-confirm/probe failures
|
||||
|
||||
## Exposed metrics
|
||||
|
||||
Relay-level labels use `{relay}` unless stated:
|
||||
|
||||
Reference in New Issue
Block a user