Skip to content

Draft: Add API for fetching zoekt indexed namespace size

John Mason requested to merge jm-api-zoekt-repo-size into master

What does this MR do and why?

Add API for fetching a Zoekt indexed namespace, given a namespace ID or path. This is useful to determine which zoekt shard a namespace is assigned to. It also includes root storage repository size in response.

Related to #406527 (closed)

Screenshots or screen recordings

http://localhost:3000/api/v4/admin/zoekt/indexed_namespaces/flightjs

{
id: 1,
zoekt_shard_id: 1,
namespace_id: 33,
repository_size: 123
}

http://localhost:3000/api/v4/admin/zoekt/indexed_namespaces/twitter

{
message: "404 Not found"
}

How to set up and validate locally

  1. Create root storage stats for flightjs namespace: Namespace.find_by_path_or_name('flightjs').create_root_storage_statistics(repository_size: 123)
  2. Go to http://localhost:3000/api/v4/admin/zoekt/indexed_namespaces/flightjs

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by John Mason

Merge request reports