# Stalker docs

Lookup for Stalker, the SlopKit Sensors that watch running software and send every Signal to rat. Source: https://gitlab.techtailors.net/slopkit/stalker. Family site: https://slopkit.dev.

This page matches slopkit/stalker `main` at commit `be099e2`: `@slopkit/stalker` 0.1.0 and `stalker-rust` 0.1.0. A first run is on Getting started at https://stalker.slopkit.dev/start/.

Stalker has no database and no query API. It collects and sends. rat stores and queries.

## Terms

Sensor
: A Stalker component that watches one kind of running software (a Node or Bun process, a Rust binary, every process on a node) and produces Signals from it without code changes.

Kernel Sensor
: A Sensor that watches every process on a machine from the kernel (eBPF). It works for any language and needs no change to the product or its build. It sees requests only as bytes, so it cannot read a product's own context.

Signal
: One kind of observability data Stalker produces: traces, logs, metrics, continuous profiles, or Function Coverage.

Function Coverage
: The set of functions (with their files) that ran while serving one request or a group of requests that share a Request Key.

Request Key
: The identity that Stalker files a request's Signals under, taken from the request's trace context and baggage (for example, a Hunt Scenario and Step). A Kernel Sensor can read it only from the first request that carries it. The rest of that trace is found by trace id.

Profile
: Samples of which stacks the CPU was running in a service over a time window, with a count per stack. It says where time went, not which functions ran for a Request Key.

Isolated Process
: A product process that serves requests from one Request Key at a time, so that its Function Coverage cannot mix with anything else.

Instrumented Build
: A binary compiled so it counts which functions run (Rust `-C instrument-coverage`). The Rust Sensor works only on one, and only for the Request Keys that reach it one at a time.

rat
: The SlopKit collector and store that Stalker sends every Signal to.

## Sensors

| Sensor | Watches | Code change | Signals |
|---|---|---|---|
| Node and Bun Sensor, `@slopkit/stalker` | A Node or Bun process | None, a preload flag | Traces, logs, Function Coverage |
| Rust Sensor, `stalker-rust` | A Rust service built as an Instrumented Build | One line, a tower layer | Function Coverage |
| Kernel Sensors, OBI and the eBPF profiler | Every process on a node | None | Traces, Profiles |

Metrics are off in the Node and Bun Sensor.

## Node and Bun Sensor

Package `@slopkit/stalker`, version 0.1.0. It needs Node 22.12 or newer. It has one entry point, `@slopkit/stalker/register`, which resolves to `register.cjs` for `require` and to `register.mjs` for `import` and the `bun` condition.

### Synopsis

```console
node --require @slopkit/stalker/register app.js
node --import  @slopkit/stalker/register app.mjs
bun  --preload @slopkit/stalker/register app.ts
NODE_OPTIONS="--require @slopkit/stalker/register" node app.js
```

Use the `NODE_OPTIONS` form when you cannot change the command. For Bun, `preload = [...]` in `bunfig.toml` also works.

### Behavior

- Starts OpenTelemetry auto-instrumentation with `@opentelemetry/auto-instrumentations-node`. `fs`, `dns` and `net` are off.
- Propagates W3C `traceparent` and `baggage`. What comes in on a request goes out on every outgoing HTTP call made while serving it. The propagators are fixed to `tracecontext,baggage`, and `OTEL_PROPAGATORS` is ignored.
- Copies baggage entries onto every span and log record as attributes. This is how a Request Key reaches rat.
- Forwards `console.debug`, `console.log`, `console.info`, `console.warn` and `console.error` as log records inside the active trace. Console output itself is unchanged.
- Sends traces to rat at `POST /v1/traces` and logs to `POST /v1/logs` as OTLP JSON, uncompressed. Spans and log records also carry `service.name` as an attribute, because rat does not keep the OTLP resource.
- Flushes every second, on `beforeExit`, and on SIGTERM and SIGINT. If the product has no signal handler of its own, Stalker exits after the flush with the usual code.
- Does not break the product. If rat is down, export errors are printed once to stderr and dropped.
- Never follows `HTTP_PROXY`, `HTTPS_PROXY` or `NO_PROXY` for its export to rat, unless `STALKER_USE_PROXY=1`.

### Configuration

Environment variables. `STALKER_*` wins over the OpenTelemetry variable with the same meaning.

| Variable | Default | Meaning |
|---|---|---|
| `STALKER_ENDPOINT` | `http://127.0.0.1:7410` | Base URL of rat. Traces go to `<base>/v1/traces`, logs to `<base>/v1/logs`. |
| `STALKER_WRITE_KEY` | none | rat write key, sent as HTTP Basic auth. Needed only when rat has `COLLECTOR_WRITE_KEYS`. |
| `STALKER_BAGGAGE_KEYS` | `*` | Which baggage entries become attributes: comma-separated names or `prefix*`. Propagation is not affected. |
| `STALKER_CAPTURE_CONSOLE` | `1` | `0` stops console capture. |
| `STALKER_BUN_WRAP` | `1` | `0` stops the `Bun.serve` and `fetch` wrappers. |
| `STALKER_FLUSH_INTERVAL_MS` | `1000` | Export interval in milliseconds. |
| `STALKER_MAX_BODY_BYTES` | `30000` | Largest request body sent to rat, in bytes. rat refuses bodies over 32 KiB. Batches are split to fit. |
| `STALKER_COVERAGE` | `0` | `1` turns on Function Coverage. |
| `STALKER_COVERAGE_KEYS` | `hunt.scenario,hunt.step` | The baggage entries that make up a Request Key. |
| `STALKER_COVERAGE_IDLE_MS` | `1000` | Files the last Request Key after this many milliseconds without a keyed request. |
| `STALKER_COVERAGE_DEPS` | `0` | `1` includes `node_modules` code. |
| `STALKER_USE_PROXY` | `0` | `1` lets the exporter follow `HTTP_PROXY` and `HTTPS_PROXY`. |
| `STALKER_DISABLED` | `0` | `1` turns the Sensor off. |
| `OTEL_SERVICE_NAME` | file name of the entry script | Service name. `OTEL_RESOURCE_ATTRIBUTES=service.name=...` also works. |
| `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`, `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT`, `OTEL_EXPORTER_OTLP_HEADERS` | none | Used when `STALKER_ENDPOINT` is not set. Always JSON, never gzip. |
| `OTEL_NODE_ENABLED_INSTRUMENTATIONS`, `OTEL_NODE_DISABLED_INSTRUMENTATIONS`, `OTEL_TRACES_SAMPLER`, `OTEL_LOG_LEVEL`, `OTEL_SDK_DISABLED` | none | Passed through to the OpenTelemetry SDK. |

### Coverage by runtime

| | Node CommonJS | Node ES modules | Bun |
|---|---|---|---|
| Incoming HTTP server span, parented on `traceparent` | yes | yes | yes, through the `Bun.serve` wrapper (`fetch` handler and `routes` function handlers, also after `server.reload`) |
| Outgoing `fetch` span and header propagation | yes | yes | yes, through the `fetch` wrapper |
| Outgoing `node:http` client | yes | yes | not covered; use `fetch` |
| Libraries (express, pg, redis and others) | yes | yes, through the import-in-the-middle loader hook | only what works through Bun's Node compatibility; untested |
| Baggage on spans and logs | yes | yes | yes |
| `console.*` logs | yes | yes | yes |

Not covered: `Bun.serve` WebSocket messages, static `routes` responses, the time spent streaming a response body (the server span ends when the handler returns the `Response`), `Bun.sql` and `bun:sqlite` calls, metrics, profiles, and function-level Function Coverage under Bun.

A Bun server span is named `<METHOD>`, or `<METHOD> <route pattern>` for `routes`. It carries `url.path`, `http.request.method`, `http.response.status_code` and the client address. The wrapper replaces `Bun.serve` and `globalThis.fetch`, so the preload must run first. `--preload` does.

### Function Coverage on Node and Bun

Set `STALKER_COVERAGE=1`. The Sensor uses V8 precise coverage (`node:inspector`, `Profiler.takePreciseCoverage`). Its counters reset on every take, so each take is the delta since the previous one.

- A Request Key is the values of `STALKER_COVERAGE_KEYS` in the request's baggage. Requests without any of them are ignored.
- A delta is taken when the first request of a different Request Key starts (it is filed under the previous key), when no keyed request has been active for `STALKER_COVERAGE_IDLE_MS`, and at shutdown.
- The result is exact only on an Isolated Process, or when requests run one at a time. Overlapping requests of two keys are still recorded, with `stalker.coverage.exact=false`.
- Work that ran with no keyed request in flight (timers, startup) is dropped. Node internals, Stalker itself and, by default, `node_modules` are left out.
- The Node Sensor files by Request Key only. It sets no trace id on coverage.

Each delta is sent to rat as OTLP logs, one log record per source file, with at most 120 functions per record.

| Field | Value |
|---|---|
| body | `{"functions":[{"name":"onlyInA","line":8,"column":1,"count":2}]}`. Line and column are 1-based. Anonymous functions are `(anonymous)`. |
| `stalker.signal` | `function_coverage` |
| `stalker.request_key` | for example `hunt.scenario=signup,hunt.step=1` |
| `hunt.scenario`, `hunt.step` | the key's baggage entries, as on spans |
| `code.filepath` | absolute path of the file |
| `stalker.coverage.granularity` | `function`; `script` for a file reported whole |
| `stalker.coverage.exact` | `true` unless requests of two keys overlapped in the window |
| `service.name` | as on every record |

Under Bun, the Sensor counts function entries itself: it adds a counter at the start of every function body when Bun loads a file of your product, without changing line numbers. JSX and TSX files, and files loaded before the preload, are reported whole: `granularity=script` and an empty `functions` list.

Measured overhead on Node, with a no-op handler on loopback: about 0.04 ms per request without Stalker, 0.11 ms with Stalker, and 0.27 ms with Stalker and coverage. The source does not measure a real product.

### Proxies

Decoy sets `HTTP_PROXY` and `HTTPS_PROXY` so a product's calls to third-party hosts reach it. Node honours them only with `NODE_USE_ENV_PROXY=1`. Bun reads them natively.

Stalker's export to rat uses `node:http` and `node:https` with a dedicated agent, so it is not proxied in Node or Bun. If rat is reachable only through a proxy, set `STALKER_USE_PROXY=1` and keep `NO_PROXY=127.0.0.1,localhost` yourself.

## Rust Sensor

Crate `stalker-rust`, version 0.1.0, in `packages/rust` of the Stalker repo. It is not published. Use it as a path dependency. It measures Function Coverage only.

A compiled binary has no preload hook, so this Sensor needs one line in the product and an Instrumented Build.

### Synopsis

```toml
# Cargo.toml
stalker-rust = { path = "../stalker/packages/rust" }
```

```rust
let coverage = stalker_rust::Coverage::from_env();
let app = Router::new().route("/path-a", get(handler)).layer(coverage.layer());
```

`coverage.layer()` is a `tower::Layer` over `http::Request` services, such as axum, hyper and tonic. For a framework without tower, wrap the work in `coverage.measure(key, async { ... })`, with `RequestKey::from_headers(&headers, &keys)`. `coverage.flush().await` waits for records sent in the background.

### Build helper

`packages/rust/scripts/stalker-rust-build [CARGO_BUILD_ARGS...]`

Runs `cargo build` with `RUSTFLAGS` extended by `-C instrument-coverage`, into its own target directory, so the normal build is untouched. Arguments are passed to `cargo build`. For example, `-p my-service` or `--release --bin api`. The binary is in `<target>/debug`, or `<target>/release`.

`STALKER_COVERAGE_TARGET_DIR`
: Target directory. Default `target/coverage`.

Without `-C instrument-coverage`, the crate compiles to a no-op and `STALKER_COVERAGE=1` prints a warning. `stalker_rust::INSTRUMENTED` tells whether the binary was built with it. Instrumented binaries are bigger and slower. Do not ship them.

### Behavior

1. A request whose `baggage` has a configured entry is a measured request. Other requests pass through untouched.
2. The layer takes a process-wide lock, resets the profile counters, runs the handler, copies the counters, and releases the lock.
3. `llvm-profdata merge -sparse -text` gives the executed functions and their entry counts. `llvm-cov export` on the binary gives each function's file and span. It is read once at startup in a background thread and cached. Only your own code is kept. The standard library, `~/.cargo`, `/nix/store` and `vendor/` are dropped unless `STALKER_COVERAGE_DEPS=1`. The source measures about 25 ms per request on the example.
4. The functions are sent to rat at `POST /v1/coverage`, one record per file.

Each record has `service`, `traceId` (from `traceparent`), `requestKey`, `scenario`, `step`, `file`, `functions`, `exact` and `language: "rust"`. Each function has `name` (demangled), `line`, `column`, `endLine`, `endColumn` and `count`.

By default the response is returned after the records are sent, so rat can already answer for that Request Key when the caller sees the response. `STALKER_COVERAGE_ASYNC=1` sends in the background.

Failures, such as rat down or missing tools, are printed to stderr and dropped. The request is never failed.

### Concurrency

The profile counters belong to the process and cannot be read per task or per thread. Function Coverage is exact only when one measured request runs at a time.

- By default (`STALKER_COVERAGE_SERIALIZE=1`) the layer queues measured requests behind a lock, so concurrent keyed requests never mix, at the cost of throughput.
- Requests with no Request Key are not queued. If one overlaps a measured request, its work is in the counters and the record is sent with `exact=false`. Health checks are the usual cause.
- `STALKER_COVERAGE_SERIALIZE=0` removes the lock. Overlapping measured requests then reset each other's counters, and every record is `exact=false`.
- Work done with no measured request in flight is dropped. Work a handler spawns that outlives the response lands in whichever request is measured next. The response body is not covered if it streams after the handler returns.
- Run the service as an Isolated Process and keep other callers off it while it is measured.

### Configuration

| Variable | Default | Meaning |
|---|---|---|
| `STALKER_COVERAGE` | `0` | `1` turns on measuring. |
| `STALKER_ENDPOINT` | `http://127.0.0.1:7410` | rat. Only `http://`, with no TLS and no proxy. |
| `STALKER_WRITE_KEY` | none | Sent as Basic auth. |
| `STALKER_COVERAGE_KEYS` | `hunt.scenario,hunt.step` | Baggage entries that make up a Request Key. |
| `STALKER_COVERAGE_SERIALIZE` | `1` | Measured requests run one at a time. |
| `STALKER_COVERAGE_ASYNC` | `0` | `1` answers before the records are sent. |
| `STALKER_COVERAGE_DEPS` | `0` | `1` keeps dependency and standard library functions. |
| `STALKER_COVERAGE_DEBUG` | unset | Print timings to stderr. |
| `OTEL_SERVICE_NAME` | executable file name | The `service` of each record. |
| `LLVM_PROFDATA`, `LLVM_COV` | `llvm-profdata` and `llvm-cov` from `PATH` | The LLVM tools. |

The two LLVM tools must come from the same LLVM as rustc (`rustc -vV` shows it). A tool older than rustc's LLVM cannot read the profile. The Stalker dev shell adds `llvmPackages_latest.llvm`.

## Kernel Sensors

Two eBPF Sensors that watch every process on a node, with no change to the product or its build:

- OBI (OpenTelemetry eBPF Instrumentation, formerly Grafana Beyla) produces spans for HTTP, gRPC, SQL, Redis, Kafka and more, and injects `traceparent` into outgoing requests.
- The eBPF profiler (`opentelemetry-ebpf-profiler`, shipped as the `otelcol-ebpf-profiler` Collector distribution) samples the CPU stacks of every process on the node.

OBI sends OTLP protobuf to an OpenTelemetry Collector sidecar in the same pod. The sidecar parses the Request Key, copies `service.name`, and sends OTLP JSON to rat at `/v1/traces`. The profiler's Collector sends OTLP profiles JSON to rat at `/v1development/profiles`.

The source states that the eBPF runtime has not been run on a real node. Configs were validated with the real binaries. See `docs/ebpf.md` in the Stalker repo for what was and was not checked.

### Kubernetes

```console
kubectl kustomize deploy/kubernetes
kubectl apply -k deploy/kubernetes
```

The first command prints what will be applied. Paths are relative to the Stalker repo.

- Namespace: `stalker`. It carries the label `pod-security.kubernetes.io/enforce: privileged`.
- rat location: the `stalker-env` ConfigMap, literal `STALKER_ENDPOINT`. Default `http://rat.hunt.svc.cluster.local:7410`. Change the literal in an overlay.
- Write key: when rat has `COLLECTOR_WRITE_KEYS`, create the Secret `stalker-rat` in the `stalker` namespace with the key `basic` set to base64 of `<write key>:`. Both agents read it when it exists and run without it otherwise.
- OBI opt-in: OBI instruments pods labelled `slopkit.dev/stalker: "true"` in the pod template. Edit `discovery.instrument` in `deploy/kubernetes/config/obi.yaml` to select by namespace or deployment instead. The profiler samples everything on the node.
- Privileged overlay: `kubectl apply -k deploy/kubernetes-privileged` sets `privileged: true` on both agents. Use it if your runtime strips capabilities.
- Pinned versions: OBI `v1.0.0` (`otel/ebpf-instrument`), Collector distributions `0.166.0`. OBI config is v1.

### Privileges and kernel

Both agents run as root in the container with `hostPID: true` and an explicit capability list instead of `privileged`.

| Agent | Capabilities |
|---|---|
| OBI | `CAP_BPF`, `CAP_PERFMON`, `CAP_NET_RAW`, `CAP_NET_ADMIN`, `CAP_DAC_READ_SEARCH`, `CAP_CHECKPOINT_RESTORE`, `CAP_SYS_PTRACE`, `CAP_SYS_ADMIN`, `CAP_SYS_RESOURCE` |
| Profiler | `CAP_BPF`, `CAP_PERFMON`, `CAP_SYS_ADMIN`, `CAP_SYS_PTRACE`, `CAP_SYSLOG`, `CAP_SYS_RESOURCE` |

- OBI needs kernel 5.8 or newer with BTF (`/sys/kernel/btf/vmlinux`). `traceparent` header propagation needs 5.17 or newer.
- On kernels 6.6.128+, 6.12.75+, 6.18.14+ and 6.19+, context propagation needs a `/sys/kernel/tracing` host mount. Without it OBI turns propagation off.
- The profiler needs kernel 5.10 or newer. Without `CAP_SYSLOG` and with `kptr_restrict` set, it stops with `failed to read kernel symbols: unable to read kallsyms addresses - check capabilities`.
- `OTEL_EBPF_ENFORCE_SYS_CAPS=true` makes OBI exit with the list of missing capabilities instead of half working.
- The capability sets come from upstream documentation. They were not run on a cluster.

### Run without Kubernetes

```console
scripts/ebpf-local.sh fetch
scripts/ebpf-local.sh check
sudo -E STALKER_TARGET_PORT=4100 scripts/ebpf-local.sh up
scripts/ebpf-local.sh status
scripts/ebpf-local.sh down
```

`fetch`
: Downloads pinned, sha256-checked binaries into `.stalker/bin`. linux/amd64 only. On another architecture set `STALKER_OBI_BIN`, `STALKER_OTELCOL_BIN` and `STALKER_PROFILER_BIN`.

`check`
: Validates every config with the real binaries and reports kernel prerequisites.

`up`
: Starts the Collector, OBI and the profiler against rat. Needs root. It refuses to run unprivileged and prints the `sudo` command.

`status`, `down`
: Report on and stop the processes. Logs and pids are under `.stalker/run/`.

`fetch` and `check` need no privileges.

| Variable | Meaning |
|---|---|
| `STALKER_ENDPOINT` | rat base URL. Default `http://127.0.0.1:7410`. |
| `STALKER_WRITE_KEY` | rat write key, when rat has `COLLECTOR_WRITE_KEYS`. |
| `STALKER_TARGET_PORT` | OBI instruments the process that listens on this port. |
| `STALKER_TARGET_EXE` | Or the executables matching this glob, for example `*/api`. One of the two is required for OBI. |
| `STALKER_ONLY` | `obi` or `profiler` starts only that one. |
| `STALKER_OBI_BIN`, `STALKER_OTELCOL_BIN`, `STALKER_PROFILER_BIN` | Use these binaries instead of `.stalker/bin`. |

### Request Keys on Kernel Sensor spans

- OBI records the incoming request's `baggage` header and the Collector sidecar parses `hunt.scenario` and `hunt.step` out of it into span attributes. It adds `stalker.request_key=hunt.scenario=..,hunt.step=..`, the same shape the other Sensors use. The raw header is not stored.
- OBI does not forward `baggage`. Only the span whose request carried the header has the Request Key. Downstream spans share the trace id but have no `hunt.*` attributes. To find every span of a Step, take the `trace_id` of the spans with that Request Key, then every span with that trace id.
- A request with only one of `hunt.scenario` and `hunt.step` gets that attribute but no `stalker.request_key`.
- `service.name`, `k8s.namespace.name`, `k8s.pod.name` and `k8s.node.name` are copied from the OTLP resource onto each span, because rat does not keep the resource.

### Profiles in rat

rat writes one `profile_samples` row per distinct stack.

- Frames are leaf first. Native code is not symbolized by the profiler, so a Rust or C frame is `<binary>+0x<address>`.
- `service` is `service.name` if present, else the Deployment, StatefulSet or DaemonSet name, else the executable name.
- Profile rows have no Request Key, because the profiler samples the node and not requests. Relate profiles to a Step by service and time window. `trace_id` is expected to be empty.
- The profiler sends one request per 10 seconds per node, unbatched. rat accepts up to 16 MiB for profile routes.

## rat endpoints Stalker uses

All are `POST` on rat's collector, default `http://127.0.0.1:7410`. Bodies are OTLP JSON, except `/v1/coverage`, which takes the flat Rust record.

| Path | Body | Sent by |
|---|---|---|
| `/v1/traces` | `{"resourceSpans":[{"scopeSpans":[{"spans":[...]}]}]}` | Node and Bun Sensor, OBI through the Collector |
| `/v1/logs` | `{"resourceLogs":[{"scopeLogs":[{"logRecords":[...]}]}]}` | Node and Bun Sensor, including Function Coverage |
| `/v1/coverage` | flat Function Coverage record | Rust Sensor |
| `/v1development/profiles` | OTLP profiles signal as JSON | The eBPF profiler through its Collector |

A success is HTTP 200 with `{"success":true}`. `/v1/metrics` also exists in rat, but the Node and Bun Sensor does not send metrics.

Constraints from rat:

- JSON only. `application/x-protobuf` and `Content-Encoding: gzip` bodies get 400.
- Body limit 32 KiB on every route except `/v1/batch` and the profile routes. Larger bodies get 413. Stalker's own exporter splits batches under 30 000 bytes. A stock exporter with its default batch of 512 spans hits 413.
- With no `COLLECTOR_WRITE_KEYS`, nothing is checked and data goes to instance `local`. With keys set, every request needs `Authorization: Basic base64("<write key>:")`, or it gets 401. The key picks the instance.
- OTLP resource attributes are dropped, so Stalker writes `service.name` onto every span and log record.
- A span is keyed by `traceId` and `spanId`, so a retried batch is idempotent. A log record is keyed by a fresh UUID unless it has a `messageId` field, so a retried log batch can store a record twice.

### Read Function Coverage back

`GET /v1/coverage?trace_id=&request_key=&scenario=&step=&service=&file=`

All query parameters are optional. Use the same `Authorization` as for ingest. The response is:

```json
{"files":[{"service":"","file":"","granularity":"","functions":[{"name":"","line":0,"column":0,"endLine":0,"endColumn":0,"count":0}]}]}
```

Counts are summed over deltas. The values above are placeholders for types, not output.

### Read other Signals back

rat has no query API on port 7410 for spans and logs. Read them over Quack, DuckDB's remote protocol, from any DuckDB client. Spans are in `otel_spans`, logs in `otel_logs`, Function Coverage in `function_coverage`, profiles in `profile_samples`. Baggage attributes are inside `payload`.

## Run the Node and Bun examples

From the Stalker repo, inside `devenv shell`:

```console
npm install
PORT=8080 node --require ./packages/node/register.cjs examples/node-server.cjs
PORT=8080 node --import  ./packages/node/register.mjs examples/node-server.mjs
PORT=8080 bun  --preload ./packages/node/register.mjs examples/bun-server.ts
curl -H 'traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01' \
     -H 'baggage: hunt.scenario=signup,hunt.step=3' localhost:8080/work
```

`/work` calls the server's own `/echo` and returns the `traceparent` and `baggage` it received. Start rat first to see the data arrive.

## Tests

```console
npm test
npm run test:rat
npm run test:ebpf
npm run test:ebpf:rat
```

- `npm test`: unit tests plus integration tests against a fake receiver that behaves like rat.
- `npm run test:rat`: the same scenario against the real rat in `../analytics`. Needs network once for DuckDB's quack extension. `RAT_DIR` overrides the path.
- `npm run test:ebpf`: renders the Kubernetes manifests and, after `scripts/ebpf-local.sh fetch`, checks the real Collector and profiler configs.
- `npm run test:ebpf:rat`: adds the real Collector to real rat, and an OTLP profiles request into `profile_samples`.

`packages/rust/test/e2e.sh`, inside `devenv shell`, builds the Rust example with coverage, starts rat, sends requests with different Request Keys and reads each key back. `cargo test` in `packages/rust` runs the Rust unit tests.

## Related

- Source and architecture decisions: https://gitlab.techtailors.net/slopkit/stalker
- Getting started: https://stalker.slopkit.dev/start/
- SlopKit: https://slopkit.dev
