Skip to content

Commit eeab6f3

Browse files
committed
Observabillity and Testing
1 parent caf127a commit eeab6f3

12 files changed

Lines changed: 1196 additions & 205 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44

5+
- **Observability:** New scripts **`scripts/simulate_mesh_ingest.sh`**, **`simulate_mesh_grafana.sh`**, **`simulate_capture_demo.sh`**, **`simulate_edge_scan.sh`**; Grafana dashboards **`monitoring/grafana/dashboards/spectral-mesh.json`** (cleartext/ingest wording + metric semantics row) and **`spectral-edge.json`** (**Job**/**Instance** variables, **HTTP 429** rate on throughput panel, simulation note). **`monitoring/README.md`** documents the script matrix.
56
- **Docs:** Refresh **Windows/macOS** descriptions across **`README.md`**, **`docs/EDGE_VS_MESH.md`**, **`docs/EDGE.md`**, **`docs/POLICY_MESH_AND_EDGE.md`**, **`docs/ENTERPRISE_SELF_HOSTED.md`**, **`docs/SAAS_ARCHITECTURE.md`**, **`docs/INFOSEC_SUMMARY.md`**, **`docs/BACKGROUND_OF_INVENTION.md`**, and **`docs/INVENTION_DISCLOSURE_OUTLINE_US.md`** to match **ingest**, **hookwire**, optional **hooks**, and **edge** vs host rolling-buffer behavior (replacing outdated “capture stub” wording).
67
- **Windows OpenSSL discovery:** **`-windows-openssl-discovery-interval`** polls module lists via Toolhelp32 and logs **`windows_openssl_module_mapped`** (`internal/capture/winssl`).
78
- **macOS Endpoint Security (opt-in build):** **`-darwin-es-mmap-watch`** with **`go build -tags spectral_es`** (CGO) subscribes to **`ES_EVENT_TYPE_NOTIFY_MMAP`** and logs **`es_openssl_mmap`** when mapped paths look like OpenSSL (`internal/capture/esmmap`, **`internal/capture/platformhint`**). Default macOS binaries omit ES linkage; use an SDK-equipped toolchain to link **EndpointSecurity.framework**.

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,13 @@ See [`openshift/README.md`](openshift/README.md) and [`openshift/daemonset.yml`]
366366
| `docs/DEPLOY_GCP_GKE.md` | **GKE + internal load balancer** + Artifact Registry |
367367
| `docs/DEPLOY_AZURE_AKS.md` | **AKS + internal load balancer** + ACR |
368368
| `packaging/systemd/` | Example systemd unit |
369-
| `scripts/simulate_mesh.sh` | Outbound HTTPS simulation for **spectral-mesh** (curl / OpenSSL) |
369+
| `scripts/simulate_mesh.sh` | Outbound HTTPS simulation for **spectral-mesh** (curl / OpenSSL, Linux eBPF) |
370+
| `scripts/simulate_mesh_ingest.sh` | **POST `/v1/ingest/chunk`** simulation (any OS; needs **`-capture-ingest-addr`**) |
371+
| `scripts/simulate_mesh_grafana.sh` | Ingest burst (+ optional split chunks) for **Grafana** mesh dashboard |
372+
| `scripts/simulate_capture_demo.sh` | Wrapper for **`cmd/spectral-capture-demo`** |
370373
| `scripts/simulate_edge.sh` | HTTP POST simulation for **spectral-edge** |
371-
| `scripts/simulate_edge_grafana.sh` | Mixed traffic to populate **Grafana** / Prometheus **`spectral_edge_*`** metrics |
374+
| `scripts/simulate_edge_scan.sh` | **POST `/v1/scan`** only (handler latency in Grafana) |
375+
| `scripts/simulate_edge_grafana.sh` | Mixed traffic for **Grafana** **`spectral_edge_*`** metrics |
372376
| `scripts/flood_https.sh` | HTTPS curl flood without API key (general testing) |
373377
| `scripts/flood_openai.sh` | Optional OpenAI API flood (curl); requires API key |
374378
| `api/spectral-edge.openapi.yaml` | OpenAPI 3 description of core **spectral-edge** HTTP routes |
@@ -450,7 +454,11 @@ Tune `MODEL` and `MAX_TOKENS` (see script header) to balance cost vs. response s
450454
| Script | Purpose |
451455
|--------|---------|
452456
| [`scripts/simulate_mesh.sh`](scripts/simulate_mesh.sh) | Outbound HTTPS via **`curl`** (OpenSSL) so **`spectral-mesh`** can observe **`SSL_write`** on Linux. Optional `TRIGGER_POLICY_MATCH=1` includes **`Project Ethos`** in the POST body for built-in policy smoke tests. |
457+
| [`scripts/simulate_mesh_ingest.sh`](scripts/simulate_mesh_ingest.sh) | **`POST /v1/ingest/chunk`** with **base64** payloads; works on **Linux / Windows / macOS** when mesh runs with **`-capture-ingest-addr`**. Optional **`SPLIT_CHUNK=1`** splits **`Project Eth`** / **`os`** across two posts (rolling-buffer demo). |
458+
| [`scripts/simulate_mesh_grafana.sh`](scripts/simulate_mesh_grafana.sh) | Calls **`simulate_mesh_ingest.sh`** with higher counts + optional split-chunk burst for **`monitoring/`** Grafana; optional **`LINUX_EBPF_SIM=1`** on Linux also runs a short **`simulate_mesh.sh`**. |
459+
| [`scripts/simulate_capture_demo.sh`](scripts/simulate_capture_demo.sh) | Runs **`go run ./cmd/spectral-capture-demo`** (split chunks via ingest API). |
453460
| [`scripts/simulate_edge.sh`](scripts/simulate_edge.sh) | HTTP **`POST`s to `spectral-edge`** (same policy / `policy_alert` shape as a TLS-terminated path). Requires **`spectral-edge`** listening (e.g. `make edge && ./spectral-edge -listen 127.0.0.1:8080`). |
461+
| [`scripts/simulate_edge_scan.sh`](scripts/simulate_edge_scan.sh) | **`POST /v1/scan`** only — moves **`spectral_edge_http_request_duration_seconds{handler="scan"}`** without incrementing **`spectral_edge_http_requests_total`**. |
454462
| [`scripts/load_edge_smoke.sh`](scripts/load_edge_smoke.sh) | Load against **`spectral-edge`** (defaults to **`/v1/scan`**); uses **`hey`** if installed, else parallel **`curl`** (`xargs -P`, same idea as **`simulate_edge.sh`**). |
455463
| [`scripts/simulate_edge_grafana.sh`](scripts/simulate_edge_grafana.sh) | Proxy + **`/v1/scan`** traffic so **Grafana “Spectral edge”** panels (throughput, alerts, handler latency) move; see script header. |
456464
| [`scripts/build_spectral_edge_release.sh`](scripts/build_spectral_edge_release.sh) | Build static **release tarballs** (same artifacts as **[`release-edge.yml`](.github/workflows/release-edge.yml)**). |

monitoring/README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Prometheus + Grafana (local observability)
22

3-
Docker Compose runs **Prometheus** (scrapes **spectral-mesh** and **spectral-edge** on the host) and **Grafana** (dashboards provisioned from this folder). The **Spectral mesh** dashboard assumes a **Linux** host sensor with live TLS capture; **Windows/macOS** builds expose the same metric names but ringbuf/uprobe series may stay at zero until capture is integrated ([`README.md`](../README.md#platforms)).
3+
Docker Compose runs **Prometheus** (scrapes **spectral-mesh** and **spectral-edge** on the host) and **Grafana** (dashboards provisioned from this folder). The **Spectral mesh** dashboard’s **cleartext chunk** panels track **`spectral_mesh_ringbuf_events_total`**, which increments on **every** `HandleChunk` **Linux eBPF** or **pluggable feeds** (ingest, hook socket, stdin JSONL). **Ringbuf drop/read-error** panels are **Linux BPF–path** metrics and often stay near zero on **Windows/macOS** or **ingest-only** tests ([`README.md`](../README.md#platforms)).
44

55
## Ports
66

@@ -44,7 +44,19 @@ Example **Prometheus alert rules**: [`prometheus/spectral-edge-rules.yml`](prome
4444

4545
If you use **`-metrics-listen 127.0.0.1:9092`**, add a second scrape job (or change targets) so Prometheus hits **`:9092`** for **`/metrics`**, not **`-listen`**.
4646

47-
For a quick smoke test without the full mesh, drive edge only (see **[`scripts/simulate_edge.sh`](../scripts/simulate_edge.sh)**). Optional load: **[`scripts/load_edge_smoke.sh`](../scripts/load_edge_smoke.sh)**. For **Grafana** time series, **[`scripts/simulate_edge_grafana.sh`](../scripts/simulate_edge_grafana.sh)** sends **proxy-path** traffic (not only **`/v1/scan`**) so **`spectral_edge_http_requests_total`** updates.
47+
**Simulation scripts** (repo root `scripts/`):
48+
49+
| Script | Purpose |
50+
|--------|---------|
51+
| [`simulate_mesh.sh`](../scripts/simulate_mesh.sh) | Linux **eBPF** path: HTTPS via **curl** → OpenSSL `SSL_write` |
52+
| [`simulate_mesh_ingest.sh`](../scripts/simulate_mesh_ingest.sh) | **POST `/v1/ingest/chunk`** (any OS); bumps same chunk counter as hooks |
53+
| [`simulate_mesh_grafana.sh`](../scripts/simulate_mesh_grafana.sh) | Ingest burst + optional **split-chunk** demo for **Grafana** |
54+
| [`simulate_capture_demo.sh`](../scripts/simulate_capture_demo.sh) | **`go run ./cmd/spectral-capture-demo`** wrapper |
55+
| [`simulate_edge.sh`](../scripts/simulate_edge.sh) | Edge **proxy-style** POSTs |
56+
| [`simulate_edge_scan.sh`](../scripts/simulate_edge_scan.sh) | Edge **`/v1/scan`** only (**handler=scan** latency) |
57+
| [`simulate_edge_grafana.sh`](../scripts/simulate_edge_grafana.sh) | Mixed proxy + scan load for dashboards |
58+
59+
Optional: **[`scripts/load_edge_smoke.sh`](../scripts/load_edge_smoke.sh)**. Mesh **ingest** example: `spectral-mesh -metrics-addr :9090 -capture-ingest-addr 127.0.0.1:9091` then **`simulate_mesh_ingest.sh`** or **`simulate_mesh_grafana.sh`**.
4860

4961
If you use another port, TLS, or a **GHCR** image from **[`release-edge`](../.github/workflows/release-edge.yml)**, edit **[`prometheus/prometheus.yml`](prometheus/prometheus.yml)** under the `spectral-edge` job (`targets`, `scheme`, `tls_config`, etc.).
5062

@@ -79,9 +91,9 @@ If scraping stays **DOWN**:
7991

8092
[`grafana/dashboards/spectral-mesh.json`](grafana/dashboards/spectral-mesh.json) (host sensor) and [`grafana/dashboards/spectral-edge.json`](grafana/dashboards/spectral-edge.json) (edge, including latency panels) are provisioned automatically. Re-import manually after edits: **Dashboards → New → Import → Upload JSON**.
8193

82-
The **Spectral mesh** dashboard includes **Job** and **Instance** template variables (multi-select, **All** = `.*`), row groupings (**Health**, **TLS capture & ringbuf**, **Uprobes & policy**, **BPF maps & rolling buffer**), a **health** stat row (aggregated error/drop rates and chunk throughput), **dashboard links** to **Spectral edge**, **Prometheus annotation** queries for firing **`SpectralMesh*`** alerts, **5m rates** on ringbuf drops (plus cumulative on the same chart), and **1h increase** helpers on policy reload alongside 5m rates.
94+
The **Spectral mesh** dashboard includes **Job** and **Instance** template variables (multi-select, **All** = `.*`), row groupings (**Health**, **Cleartext ingress & chunk throughput**, **Uprobes & policy**, **BPF maps & rolling buffer**, **Metric semantics**), a **health** stat row (aggregated error/drop rates and chunk throughput), **dashboard links** to **Spectral edge**, **Prometheus annotation** queries for firing **`SpectralMesh*`** alerts, **5m rates** on ringbuf drops (plus cumulative on the same chart), **1h increase** helpers on policy reload alongside 5m rates, and a **Capture paths vs counters** note (ingest/hook vs BPF-only panels).
8395

84-
**Edge metrics** include counters (requests, alerts, truncations, allowlist/dedupe/rate-limit suppressions, policy reloads, upstream errors, gzip decode, generated **X-Request-Id**, response-scan alerts when enabled) and histograms (request duration by handler, policy scan duration, upstream round-trip). The **Spectral edge** Grafana dashboard charts throughput, **optional features** (gunzip, request IDs, response policy alerts), p50/p95 latency, suppression rates, upstream errors, and SIGHUP reload activity. See **[`docs/EDGE.md`](../docs/EDGE.md)**.
96+
**Edge metrics** include counters (requests, alerts, truncations, **HTTP 429** rate-limit path, allowlist/dedupe/rate-limit suppressions, policy reloads, upstream errors, gzip decode, generated **X-Request-Id**, response-scan alerts when enabled) and histograms (request duration by handler, policy scan duration, upstream round-trip). The **Spectral edge** Grafana dashboard adds **Job** / **Instance** variables, charts throughput (including **HTTP rate limited /s** when **`-http-ratelimit-rps`** is used), **optional features** (gunzip, request IDs, response policy alerts), p50/p95 latency, suppression rates, upstream errors, SIGHUP reload activity, and a **Simulation scripts** note. See **[`docs/EDGE.md`](../docs/EDGE.md)**.
8597

8698
## Stopping
8799

0 commit comments

Comments
 (0)