tsdb

package
v0.1.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package tsdb defines the embedded time-series store contract (spec §3.10): per-series ring buffers, 15s raw resolution for 24h + 5m downsampled for 30d. Implementation is task T-59; the fake lives in testutil.

Index

Constants

View Source
const (
	RawStep       = 15 * time.Second
	RawRetention  = 24 * time.Hour
	DownStep      = 5 * time.Minute
	DownRetention = 30 * 24 * time.Hour
)

Resolutions stored by the ring TSDB.

Variables

This section is empty.

Functions

This section is empty.

Types

type Point

type Point struct {
	Time  time.Time
	Value float64
}

Point is one sample.

type SeriesKey

type SeriesKey struct {
	// Metric name: "cpu_percent", "memory_bytes", "rps", ...
	Metric string
	// Scope: "node", "instance", "env", "app".
	Scope string
	// ID of the scoped object.
	ScopeID string
}

SeriesKey identifies one series.

type Store

type Store interface {
	// Record adds a sample (typically every 15s per series). Out-of-order
	// samples older than the current slot are dropped.
	Record(key SeriesKey, p Point)
	// Query returns points in [since, until] at the best-fitting resolution
	// for step (RawStep or DownStep).
	Query(key SeriesKey, since, until time.Time, step time.Duration) []Point
	// Keys lists series matching a scope filter ("" matches all).
	Keys(scope, scopeID string) []SeriesKey
	// Flush persists ring state to disk (called periodically and on stop).
	Flush() error
	Close() error
}

Store is the per-node TSDB.

Jump to

Keyboard shortcuts

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