[Feature] Add Sampling Pipeline management to Canopy
- Dominant language
- Java
- Stars
- 25k
- Forks
- 6.6k
- Avg merge
- 10h 5m
- Merged PRs (30d)
- 16
Description
## Summary
Add **Sampling Pipeline management** to the Canopy web console, mirroring the existing TopN pipelines UI. Sampling pipelines are part of the BanyanDB trace pipeline (see `docs/design/post-trace-pipeline.md`, `docs/design/trace-fragment-sampling-guard.md`, `docs/design/trace-drop-set-bounding.md`) but currently have no first-class UI for create / list / edit / delete.
## Motivation
Canopy already exposes TopN aggregation pipelines (`web/src/pipelines/`, design in `docs/pipelines-design.md`). Sampling is the other half of the trace pipeline story and operators need to manage sampling rules from the same UI rather than editing proto/YAML or hitting raw HTTP endpoints.
## Goals
- A new **Sampling Pipelines** section under the existing Pipelines page (sibling to TopN).
- Full CRUD against the BanyanDB sampling-pipeline API.
- Visual editor + raw-YAML/code editor view, consistent with the TopN UX.
## Tasks
1. **Research** —
- Identify the BanyanDB HTTP endpoints that expose sampling pipelines (proto/REST under `banyand/`).
- Map the schema (`SamplingPipeline` / equivalent) to a TypeScript DTO in `shared/`.
- Review the existing TopN implementation (`web/src/pipelines/`) for reuse patterns.
2. **Design doc** — write `canopy/docs/sampling-pipelines-design.md` covering:
- Page layout (list + detail + form).
- YAML/code vs. form-based editing.
- Validation rules and dry-run/preview.
- Role enforcement (`admin` only? also `readonly` for list?).
3. **PoC** — implement:
- `canopy/server/src/routes/sampling.ts` (or extend proxy) — CRUD proxy routes.
- `canopy/shared/src/sampling.ts` — DTOs.
- `canopy/web/src/pipelines/sampling/` — `SamplingList`, `SamplingDetail`, `SamplingForms`, result viewers.
- Sidebar/route wiring in `canopy/web/src/App.tsx`.
4. **Tests** — Vitest tests for BFF proxy, component tests for forms/list, e2e smoke under `canopy/e2e/` (similar to TopN e2e).
5. **Docs** — update `canopy/README.md`; link from `docs/design/post-trace-pipeline.md`.
## Acceptance Criteria
- New `/pipelines/sampling` route reachable from the sidebar.
- Full CRUD (create, list, view, edit, delete) against a real BanyanDB.
- Validation surfaces backend errors clearly (form + code view).
- Role enforcement: `admin` for write operations; `readonly` can list/view.
- Unit + e2e tests pass.
- Docs updated.
## Out of Scope
- Live trace preview / sampling-rate simulation.
- Cross-pipeline ordering or composition (sampling ⇄ topn).
- Any backend changes to BanyanDB's sampling pipeline semantics — UI only.
Contributor guide
Research direction
Start by reading web/src/pipelines/ and the related design documents, then inspect the BanyanDB proto/REST endpoints under banyand to map the sampling schema. Review the existing TopN flow before planning the DTOs, proxy routes, UI, tests, and documentation. Done means the sampling route is wired into the sidebar, supports role-aware CRUD, has form and code editing with validation, and passes unit and e2e tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend, documentation, frontend, observability, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100