retention

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package retention applies the current retention_period and retention_stream to the stored data (Loki's compactor.retention_enabled).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sweeper

type Sweeper struct {
	Conn     driver.Conn
	DB       string
	Topo     chstore.Topology
	Limits   *validation.Overrides
	Interval time.Duration
	Logger   log.Logger
	// Now returns the current time for Run (default time.Now).
	Now func() time.Time
}

Sweeper removes data older than the retention that is configured now. A UTC day D with a retention of N days is removed once D+N <= today (UTC). Every step is idempotent, so several instances may sweep at once.

func (*Sweeper) Run

func (s *Sweeper) Run(ctx context.Context)

Run calls Sweep every Interval until ctx ends; errors are logged.

func (*Sweeper) Sweep

func (s *Sweeper) Sweep(ctx context.Context, now time.Time) error

Sweep applies the retention configured now, as of now. Errors are collected; a failing step does not stop the others.

Jump to

Keyboard shortcuts

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