backend

package
v0.0.1-dev.137 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package backend selects and constructs the observe.LogStore for the runefile-configured backend value (plan §5). It lives in its own package so the core observe package stays free of store imports (avoiding an import cycle): the stores depend on observe, and backend depends on both.

The control plane calls Open after parsing the [observability] runefile block so the rest of the program is backend-agnostic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(b Backend, opts Options) (observe.LogStore, error)

Open constructs the LogStore for the given backend. An empty backend defaults to embedded so a bare `[observability] enabled = true` block works out of the box (plan §5).

Types

type Backend

type Backend string

Backend names the runefile storage choice. The [observability].backend value selects the store.

const (
	// BackendEmbedded is the in-process default (Core tier). Ships in runed.
	BackendEmbedded Backend = "embedded"
	// BackendLoki is the light optional sink (Core tier only).
	BackendLoki Backend = "loki"
	// BackendClickHouse is the analytical optional sink (Core + Advanced tiers).
	BackendClickHouse Backend = "clickhouse"
)

type ClickHouseConfig

type ClickHouseConfig struct {
	DSN      string
	Database string
	Table    string

	// RetentionDays sets the table's DELETE TTL (drop parts older than N days).
	RetentionDays int
	// AutoMigrate runs CREATE DATABASE/TABLE on first connect (zero-config).
	AutoMigrate bool

	// S3 tiering (see clickhouse/schema.go). StoragePolicy is the server-
	// configured policy naming the hot+s3 volumes; HotDays moves parts older
	// than N to S3Volume. Empty StoragePolicy disables tiering.
	StoragePolicy string
	S3Volume      string
	HotDays       int
}

ClickHouseConfig mirrors clickhouse.Config for the same reason.

type EmbeddedConfig

type EmbeddedConfig struct {
	RetentionDays int
	MaxRecords    int
	// Dir enables disk persistence: a node-local WAL under this directory (set
	// to <data-dir>/observe by runed) so logs survive a restart. Empty =
	// in-memory only.
	Dir string
	// MaxDiskBytes caps WAL disk usage (drop-oldest); 0 uses the embedded default.
	MaxDiskBytes int64
}

EmbeddedConfig mirrors embedded.Config without forcing callers to import the embedded package directly.

type LokiConfig

type LokiConfig struct {
	BaseURL  string
	TenantID string
}

LokiConfig mirrors loki.Config so callers can configure the Loki backend without importing the store package directly.

type Options

type Options struct {
	Embedded   EmbeddedConfig
	Loki       LokiConfig
	ClickHouse ClickHouseConfig
	Logger     log.Logger
}

Options bundle every backend's config; Open uses the one matching the selected backend.

Jump to

Keyboard shortcuts

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