Files
leleka/README.md
T
Pavlo RatushnyiandClaude Sonnet 5.5 fb10bf0e70 observability: structured bounded logs, per-request record, metrics, leleka logs / report
* crates/obs (leleka-obs, std only): one event per line (JSON under `leleka run`, key=value on a terminal, the lab's plain lines when a
  binary is started by hand into a file), UTC ms timestamp, level, component, event, flat fields; prompt/completion text and credentials
  never appear (key classes + value scrub + registered secrets), per-event token buckets with a `suppressed` count, value and line caps,
  histogram with Prometheus exposition, size-capped file sink for requests.log.
* control-plane: `observe` middleware gives every generation request an id (x-leleka-request-id header) and a session tag (hash of the
  client's session header); the worker marks engine start / first token / terminal / error on it and one record is written at request end
  (tokens, cached prefix, queue wait, TTFT, prefill/decode tok/s, finish, error class, engine restart, GPU clock/temp/throttle). All
  elog! lines go through the log layer (sampled per call site). /metrics?format=prometheus gains request counters and histograms, engine
  lost/attached counters, uptime and supervisor restarts, PCIe, memory clock, throttle reasons, speculative tokens per round, expert-tier
  entries by tier and hit ratio.
* engine: one structured line per request with the same id (rounds, tokens per round, expert-tier share served from VRAM/PCIe/CPU for that
  request); telemetry gains spec / expert_tier / last_request; NVML sampler reads PCIe throughput, memory clock, throttle reasons.
* supervisor: structured events (engine exit, health, restarts), secrets registered with the log layer, children get LELEKA_REQUEST_LOG,
  LELEKA_STATUS_FILE, LELEKA_PROFILE and JSON logging; runtime-client and gateway log connect/probe failures as sampled events.
* leleka logs (--tail/--since/--level/--component/--source/--request/--follow), leleka report (sanitized support bundle, written only with
  --yes, nothing sent anywhere), request statistics in leleka status / verify --quick.
* generation, sampling and kernels are untouched; the lab scripts keep their plain lines (LELEKA_LOG_FORMAT=legacy or a hand-started binary).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 23:25:24 +01:00

4.8 KiB

Leleka / Strata Next

Leleka is the independent Rust NVIDIA inference runtime being developed from this repository. The complete tracked Strata Next source tree was imported from paveldhq/strata-next commit 1263e88f8947b9796924eb7e8d8d7af08b589049; see docs/upstream.md for the pinned Strata engine provenance. The imported desktop application, Rust control plane, deployment code, model tooling, tests, and reference engine are all here.

The migration is staged: Leleka must eventually run without a Strata process, Strata source, Python, or a separately installed CUDA Toolkit on the target host. Until the replacement passes the same protocol, model-quality, and operational gates, Strata remains the behavior baseline. No model family or performance gain is claimed for Leleka until its real-model gates pass.

Repository layout

  • crates/backend-api/ — Leleka's versioned Rust backend contract.
  • crates/tokenizer/ — the Qwen35 byte-level BPE tokenizer extracted as a backend-independent Rust crate.
  • desktop/, desktop-core/ — current desktop application and its Rust core.
  • control-plane/ — current Rust API, Responses handling, and worker supervisor.
  • engine/strata/ — pinned upstream Strata reference; retained during migration.
  • gpu/ — experimental optimization components, including KAR.
  • integrations/, manifests/, deploy/, scripts/ — client integration, model profiles, packaging, and development/test tooling.
  • PROJECT_CHARTER.md, docs/ — requirements, provenance, decisions, and performance/quality gates.

Model weights, request captures, credentials, local logs, and generated build artifacts remain outside Git or under ignored paths.

Current Leleka scope

Leleka currently has a versioned backend contract and a standalone Qwen35 BPE tokenizer crate. The existing Rust control plane now consumes that shared tokenizer crate instead of maintaining a second copy; its oracle-parity tests remain in the workspace. Leleka still has no independent inference backend or CUDA integration, so this does not yet serve a model independently. The desktop app and the rest of the control plane remain available as migration source in this repository.

Observability

What the service is doing, and why a request was slow or failed, is in its logs; nothing needs a debugger, and nothing leaves the machine.

  • Logs. STATE/logs/{leleka,engine,gateway,api,requests}.log, one JSON object per line: UTC timestamp (ms), level, component, event, flat fields. The supervisor rotates them by size (leleka.json logs); a repeating event is sampled (a burst, then one line per 10 s with a suppressed count), so a failure loop cannot fill the disk. Prompts and answers are never written; the API key and tokens are scrubbed from every line. LELEKA_LOG_LEVEL, LELEKA_LOG_FORMAT=json|text|legacy and LELEKA_LOG_DEBUG=1 (adds the length of redacted text) are read by every process. A binary started by hand keeps the plain lines that scripts/e2e parses.
  • One record per request (requests.log, about 0.5 KB): request id (also the x-leleka-request-id response header), session tag, dialect, model, profile, prompt / cached / output tokens, queue wait, time to first token, prefill and decode tok/s, finish reason, error class, whether the engine was lost meanwhile, GPU clock, temperature and throttle reasons. The engine writes its own line for the same id (tokens per speculative round, expert-tier share served from VRAM / PCIe / CPU).
  • Commands. leleka logs --tail 100 --since 1h --level warn, leleka logs --request ID (API and engine lines of one request, joined), leleka status / leleka verify --quick (request statistics of the last quarter hour, failures), and leleka report: a sanitized support bundle (versions, commit, Strata pin, profile, expert tier ON/OFF with digest, hardware, service health, request statistics, the last 50 request records, recent warnings) in one JSON file. report shows what it would contain and writes only with --yes; you attach the file yourself. See leleka --help.
  • Metrics. GET /metrics?format=prometheus: request counters by endpoint and outcome, histograms (time to first token, duration, queue wait, tokens, tok/s), engine restarts and uptime, queue depth, VRAM and host memory, GPU clocks / temperature / power / throttle reasons, PCIe MB/s, speculative tokens per round, expert-tier entries by tier. Every label value comes from a fixed list.

Development

Run the Rust workspace tests and lint:

cargo test --workspace --locked
cargo clippy --workspace --all-targets --all-features -- -D warnings

For the Linux release requirements, see PROJECT_CHARTER.md and the independent engine design.