Handbook - Operations

Retention Operations

Retention policy CRUD is implemented per project; deletion execution is owned by a separate storage-maintenance boundary.

On this page

Retention is configured per project. Project retention policy CRUD is implemented through GraphQL, the BFF bridge, control-plane storage, and the project settings UI. Deletion execution is a separate storage-maintenance boundary, not frontend or BFF behavior.

Current Product Behavior

Project admins can read and save the effective retention policy for a project. A policy has exactly one rule per data class, and updates replace the complete rule set using optimistic version checks.

Saved policies are durable configuration. The repository includes the storage-maintenance batch executor, scheduler loop, lease-aware fixture implementation, SurrealDB retention adapter, and service image/chart shape. Production deletion still depends on enabling the scheduler for the intended project IDs and validating the deployment with the opt-in SurrealDB retention tests for the data classes you plan to execute.

Data Classes

Data classDefault
TRACESDelete after 30 days
LOGSDelete after 30 days
METRICSDelete after 30 days
AI_EVALSDelete after 90 days
DATASETSRetain
SCORERSRetain
DASHBOARD_HISTORYRetain
INGEST_CREDENTIAL_AUDITDelete after 365 days

Dashboard definitions, current project configuration, users, companies, memberships, and active ingest credential metadata are not deleted by telemetry retention.

Lifecycle

diagram
No Yes Project admin Save full policywith expectedVersion GraphQL BFF control-planeretention_policy record Policy visible in project settings storage-maintenanceworker running? Configuration onlyno telemetry deletion Project-scoped batchby data class Soft delete modehide from normal reads Hard delete moderemove eligible records Final delete after softDeleteDays Batch counts and logs
Mermaid diagram rendered with beautiful-mermaid.

Operator Checks

When deletion execution is present, operators should check:

  • project ID and data class in maintenance logs;
  • matched, hard-deleted, soft-deleted, and final-deleted counts;
  • policy version used by the batch;
  • terminal errors and retry behavior;
  • confirmation that no deletion crosses tenant/company/project boundaries.

Scheduler Configuration

The scheduler is disabled by default. In production-style SurrealDB builds, CLOUDGRID_STORAGE_ADAPTER=surrealdb wires storage-maintenance to the SurrealDB retention adapter; fixture builds use the in-memory fixture adapter for tests only.

VariableDefaultPurpose
CLOUDGRID_RETENTION_SCHEDULER_ENABLEDfalseEnables scheduled deletion in storage-maintenance.
CLOUDGRID_RETENTION_SCHEDULER_INTERVAL_SECONDS3600Tick cadence, from 5 minutes to 24 hours.
CLOUDGRID_RETENTION_SCHEDULER_PROJECT_IDSnoneComma-separated project IDs for the first production wave.
CLOUDGRID_RETENTION_BATCH_LIMIT1000Maximum rows per project/data-class batch.
CLOUDGRID_RETENTION_LEASE_SECONDS900Lease duration per project/data class.
CLOUDGRID_STORAGE_ADAPTERsurrealdb in SurrealDB buildsSelects the compiled storage-maintenance adapter.

When enabled, the scheduler iterates configured project IDs and every retention data class. One failed project/data class does not stop the rest of the tick. Multiple storage-maintenance replicas coordinate with a lease key shaped as retention:{projectId}:{dataClass}.

Do not add custom runbook commands around retention until the executable exposes them. The private batch contract is storage_maintenance.retention.execute_batch.

Safety Rules

  • Retention deletion must be project-scoped.
  • Soft-deleted records are hidden from normal GraphQL reads.
  • retain means no automatic deletion for that data class.
  • The BFF and frontend must not implement deletion loops.
  • Storage-write remains the normal telemetry mutator; retention deletion is a maintenance mutation boundary.

Next Step

Review the concept page: Retention and alerts.

Last updated .