SKEG · OPERATE

Monitor Skeg and investigate queries

Read metrics, logs and index diagnostics, then choose what to investigate.

Skeg 0.8 · Development documentation

Use metrics for trends, logs for failure details and index diagnostics for the state of a particular index. Start with the question you need to answer:

QuestionUse
Is the listener reachable after startup?The container TCP health check or an application connection
Are requests getting slower or more frequent?Operation counters, duration histograms and client measurements
Is maintenance keeping up with writes?SKEG.HEALTH <index> and maintenance counters
Did index consistency checks find a problem?SKEG.CHECK <index> and its complete report
Why did this query do so much work?SKEG.VSEARCH ... EXPLAIN

For a readiness check that includes application data, follow startup and recovery. Use metric semantics and coverage to check scope, labels and update cadence before building alerts from a series.

Enable metrics

You need a server built with metrics-http, a free local port and permission to open a fresh data directory. To enable metrics on an existing deployment, set observability.metrics_port in the server configuration and restart through the service manager. To try it locally, start a server:

RUST_LOG=info skeg --data-dir ./monitoring-example --addr 127.0.0.1:6380 --metrics-port 9090

Read its Prometheus endpoint from the same host:

curl --fail --silent --show-error http://127.0.0.1:9090/metrics

Expect text containing # TYPE declarations and metric samples. Zero counters are normal before relevant operations occur. If the feature is absent or the port cannot be bound, requesting the exporter makes startup fail.

The exporter binds to 127.0.0.1, separately from the database listener. Database authentication does not protect this HTTP endpoint. A remote collector needs a local agent or a deliberately configured proxy. In a container, loopback belongs to that container: publishing port 9090 alone does not make this loopback-only exporter reachable from another container. Stop the local example with Ctrl+C when you finish.

Scrape with Prometheus

For Prometheus running in the same network namespace, add this job to its configuration:

scrape_configs:
  - job_name: skeg
    scrape_interval: 15s
    static_configs:
      - targets: ['127.0.0.1:9090']

Confirm that the target is up before interpreting missing series as database behaviour. Retain the instance label so separate servers remain distinguishable. Counters reset on process restart; use counter-aware functions such as rate and increase over windows containing enough samples.

Read request activity and latency

skeg_ops_total{op="..."} counts instrumented operation classes. skeg_op_duration_seconds is their duration histogram, in seconds. Current classes include get, set, del, vset, vsearch, vdel and ping. They are not a one-to-one log of every RESP command: KV batch work can be recorded as a storage operation, and vector-batch items are individual writes.

Operation rates by instance and class:

sum by (instance, op) (rate(skeg_ops_total{job="skeg"}[5m]))

Vector-search p99 by instance:

histogram_quantile(0.99,
  sum by (instance, le) (
    rate(skeg_op_duration_seconds_bucket{job="skeg", op="vsearch"}[5m])
  )
)

The quantile is estimated from histogram buckets. It is not the duration of an individual request. An idle or newly started instance may have insufficient observations for a useful quantile. To aggregate several instances deliberately, combine their bucket counts first; averaging their p99 values does not produce a combined p99.

The operation series have no success/failure label and do not describe every request rejected before execution. Successful vector searches are timed once around the server’s search/merge path. Do not use these series alone as a request-success rate or as the caller’s latency: measure client timeouts, connection setup, queueing and end-to-end completion separately.

Investigate a latency increase

Pick the affected instance and time window. Compare the application’s end-to-end latency with the server’s vector-search p99 for that interval.

ObservationWhat to inspect next
Client latency rises while server search p99 stays near baselineCheck the observation count, client timeouts and ingress stalls. Time spent waiting for room to receive a request is outside the search histogram.
Server search p99 risesRun the same query with EXPLAIN and inspect which shard and phase take the most time. Keep the query vector, filter and search effort fixed.
One shard shows a growing backlogCompare its run and delta counts with the other shards. Check maintenance deferrals and failures in the same interval.

Read memory and maintenance signals

SignalInterpretation
skeg_memory_budget_state{state="known"}The admission governor has a finite readable budget.
skeg_memory_budget_state{state="unlimited"}No finite admission budget applies; this is not free host memory.
skeg_memory_budget_state{state="unknown"}Applicable headroom could not be established.
skeg_memory_headroom_bytesHeadroom after the retained reserve, before outstanding promises are accounted against it; present only when known.
skeg_memory_reserved_bytesOutstanding memory promises tracked by the governor.
skeg_ingress_cap_bytes and skeg_ingress_held_bytesNetwork buffer cap and held bytes. Read them alongside skeg_ingress_state.
skeg_ingress_stalls_totalReads paused while waiting for buffer space. A stall can end with a successful request.
skeg_maintenance_budget_skips_totalMaintenance deferred because its working set could not be admitted.
skeg_maintenance_failures_totalMaintenance attempted and failed.
skeg_maintenance_cleanup_failures_totalCommitted maintenance left cleanup work behind.
skeg_payload_post_commit_failures_totalA vector committed but later payload indexing or cleanup encountered a failure.

The budget-state series use one active value of 1 and the other states at 0. An absent headroom sample is not a zero-byte reading. Follow the state series, actual process/container memory and host pressure together. The governor does not impose an OS RSS cap. See operations.

Inspect counter increases over time. A nonzero lifetime total alone does not say a fault is happening now. For example, deferred maintenance calls for checking headroom and backlog; failed maintenance calls for inspecting the corresponding logs and storage. Repeatedly forcing consolidation can add work without resolving the cause.

To see whether ingress stalls increased in the same window as a latency change, query the event count by instance:

sum by (instance) (increase(skeg_ingress_stalls_total{job="skeg"}[5m]))

If it rises, compare buffer usage with the cap and check skeg_ingress_refused_growth_total for frames refused on buffer growth.

Inspect one index

From a connection to the intended tenant namespace, use:

SKEG.VINDEX.INFO <index>
SKEG.VINDEX.SHARDS <index>
SKEG.HEALTH <index>
SKEG.CHECK <index>

INFO gives structured configuration and counts. VINDEX.SHARDS returns a text report of per-shard LSM state; compare per-shard backlog with per-shard conditions rather than treating an aggregate run count as one shard’s debt.

HEALTH reports maintenance state. An unassessed or partial index is not a healthy index whose counts happen to be zero. CHECK reads index structures and reports the problems it finds; its no-problem result is the text bulk string OK\n, rather than a count of validated application documents.

Read the complete report, not just whether the RESP request succeeded. These commands can incur inspection work, so choose their cadence for the workload rather than running all of them on every liveness probe. See diagnostic command contracts.

Understand a query

Append EXPLAIN to the query you want to investigate:

SKEG.VSEARCH name k l_search vector [WITHPAYLOAD] [FILTER expr] EXPLAIN

The response is [hits, profile_text]. The hit array retains its usual pair or triple format. Look at the chosen plan, matching rows, candidates, rerank reads and phase times. An omitted phase did not run. For a runnable query example, see search requests and results.

Shards run in parallel. Profile totals sum work counts but use the slowest shard’s time for each phase; adding those phase times does not reconstruct an end-to-end timeline. The profile also reports merge and wall time. Client latency can include work outside that server-side measurement. Compare the per-shard sections when one phase dominates. A run_scan_fallback count means the query scanned runs in that shard. Use SKEG.VINDEX.SHARDS to inspect its run backlog.

The profile’s text, labels and units can change. Read it as a diagnostic rather than parsing it as a stable interface. For eligibility and missing neighbours, follow filtered search and search troubleshooting.

Keep useful logs

Set RUST_LOG=info in the service environment to retain startup and operational messages. A more selective filter can enable one module while leaving others at a lower level. The default formatter writes text through Rust’s tracing subscriber; it is not a JSON event API.

Preserve timestamps, the executable version and the relevant startup settings with an incident report. Pair a counter increase with its logs before deciding to retry writes or restart the server. Expected admission refusals may have sampled warning logs, so warning-line count is not an error-rate metric.

Retain shutdown evidence

Keep the supervisor’s exit status and final logs. Shutdown counters may be incremented immediately before the process exits, so the last scrape can miss them. Investigate synchronisation errors and a nonzero exit before assuming that the final shutdown barriers succeeded. Follow graceful shutdown for stop-time allowances.