seed

package
v0.24.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package seed seeds demo data by replaying bundled capture corpora through the normal ingest write path.

The old demo seed fabricated derived rows (hand-written node chains) directly into storage; that data could drift from what real capture produces and exercised none of the pipeline. This seed instead replays real captured sessions — the gzipped raw_turns JSONL corpora also used by the derive regression tests — through an in-process ingest server, then runs the deriver. Seeded data is therefore indistinguishable from live capture: it lands in raw_turns, creates sessions rows via the same ingest transaction, and projects traces/ spans through the same derive pass.

Re-running the seed is a no-op: raw-turn deduplication (org_id + request_id) absorbs replayed wire turns, the transcript dedup key includes a content hash, and the derive pass is idempotent.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedDriver = errors.New("demo seeding requires the raw-turn layer (Postgres driver)")

ErrUnsupportedDriver is returned when the storage driver cannot host the raw-turn layer or the derive pass (e.g. the in-memory driver).

Functions

This section is empty.

Types

type Result

type Result struct {
	// Sessions is the number of demo sessions the corpora replay into.
	Sessions int `json:"sessions"`
	// RawTurns is the total number of corpus rows replayed.
	RawTurns int `json:"raw_turns"`
	// RawTurnsInserted counts rows that landed as new raw turns;
	// RawTurnsDeduped counts replays the raw layer's dedup absorbed
	// (a re-seed reports everything deduped).
	RawTurnsInserted int64 `json:"raw_turns_inserted"`
	RawTurnsDeduped  int64 `json:"raw_turns_deduped"`
	// NodesDerived counts derived rows upserted by the synchronous
	// derive pass across the seeded sessions.
	NodesDerived int `json:"nodes_derived"`
}

Result summarizes one seeding run.

func Run

func Run(ctx context.Context, driver storage.Driver, logger *slog.Logger, orgID string) (*Result, error)

Run seeds the demo corpora into the given driver for orgID (the nil-UUID sentinel or "" both mean the default tenant). It replays every bundled corpus through an in-process ingest server — the same handlers wire capture lands on — and then derives each seeded session synchronously so the trace/span projection is queryable the moment the call returns (no derive worker required).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL