Product
Platform overview Tomosu engine (open source) Tomosu Cloud Reliability rules
Solutions
Prevent outages before merge Reliability Radar Fix safety For developers For SRE and platform teams
Developers
Quickstart Documentation Contribute a rule
Resources
Blog Case studies Learn FAQ News
Company
Pricing About Contact Join the Waitlist
Theme

Code indexes

A code index is how the engine knows which function a production signal comes from. CI builds one per commit with tomosu index; the engine reads it from a folder or your bucket and matches it to service.version. An index holds facts about the code, not source files.

  • tomosu index
  • index push / pull
  • S3, GCS, Azure Blob
  • Updated

What is a code index?

A code index is the set of facts the rules run against, for one repository at one commit: which function calls what, with which arguments, inside which loops and error handlers, plus short fragments such as a SQL string. It does not hold source files. The engine uses indexes to link production to code, so it never needs access to your repositories.

How do I build one?

Build it per commit, usually in CI. --pack writes a compressed package with a manifest; the same commit always produces the same bytes.

$ tomosu index . --repo demo/shop --pack --out dist/indexes
indexed 1 files (134 sites) at 4844bbe77b86c266f52273791fa5d9c04b593fdb into dist/indexes/demo-shop@4844bbe77b86.manifest.json (10314 bytes compressed)

Name the services that run this code with --service, so the engine knows which index belongs to which service. To let the engine check that an index came from your CI, sign it with your own key:

tomosu keys generate --out ci-keys          # once; keep ci-keys/signing.json as a CI secret
tomosu index . --service shop --sign-key ci-keys/signing.json --out dist/indexes

How does the engine get the index?

WayHow
A folderPut index files in the engine’s index folder (--index-dir, default <data-dir>/indexes). New files are picked up every 15 seconds without a restart.
Your bucketCI runs tomosu index push --to s3://bucket/prefix dist/indexes; the engine pulls new packages every minute with --index-source s3://bucket/prefix.
An air-gapped transfertomosu index pull --from <store> --to <folder> runs the same pull once, from cron.

Supported storage: a local or mounted folder, Amazon S3 and S3-compatible stores (MinIO, Ceph, Cloudflare R2, Wasabi), Google Cloud Storage and Azure Blob Storage. Credentials come from the usual environment variables or workload identity. index push skips packages already stored, uploads data before its manifest, and retries with backoff, so it is safe on every commit.

In the console, Settings → Code indexes chooses the storage without flags, and Test connection checks it read-only (tomosu settings test-index-store).

Which index does a service use?

  1. The index names the service (--service), or --map service=repo assigns it, or the repository name equals the service name.
  2. The running service.version matches the index’s commit, or its --version label. That is an exact match.
  3. Otherwise the newest index for that service is used, and every link’s confidence is lowered and says why.

If no index covers a service, nothing is linked, and the console says so instead of guessing.

How do I see what is loaded?

Indexes & storage lists every loaded index: repository, commit, services, languages, files, lines, the sites rules can match and their kinds, and its size. Open one to see what it contains, file by file.

The Indexes and storage page: the index folder, the storage it pulls from, and two loaded indexes, demo/partners and demo/shop, each with its commit, service, language, files, lines, sites, size and age.
Indexes & storage, with the demo’s two indexes.

To accept only indexes your CI signed, start the engine with --index-key ci-keys/signing.pub.json --index-require-signed. A package that fails its checks is refused and listed with the reason; the engine keeps working with the indexes it already has.