Help us shape the future of Go! Take the 2026 Go Developer Survey

agent

package
v0.54.2 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultTruncateFrequency = 2 * time.Hour
	DefaultMinWALTime        = int64(5 * time.Minute / time.Millisecond)
	DefaultMaxWALTime        = int64(4 * time.Hour / time.Millisecond)
)

Default values for options.

View Source
var ErrUnsupported = errors.New("unsupported operation with WAL-only storage")

Functions

This section is empty.

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

DB represents a WAL-only storage. It implements storage.DB.

func Open

func Open(l log.Logger, reg prometheus.Registerer, rs *remote.Storage, dir string, opts *Options) (*DB, error)

Open returns a new agent.DB in the given directory.

func (*DB) Appender

func (db *DB) Appender(context.Context) storage.Appender

Appender implements storage.Storage.

func (*DB) ChunkQuerier

func (db *DB) ChunkQuerier(int64, int64) (storage.ChunkQuerier, error)

ChunkQuerier implements the Storage interface.

func (*DB) Close

func (db *DB) Close() error

Close implements the Storage interface.

func (*DB) ExemplarQuerier

func (db *DB) ExemplarQuerier(context.Context) (storage.ExemplarQuerier, error)

ExemplarQuerier implements the Storage interface.

func (*DB) Querier

func (db *DB) Querier(int64, int64) (storage.Querier, error)

Querier implements the Storage interface.

func (*DB) SetWriteNotified

func (db *DB) SetWriteNotified(wn wlog.WriteNotified)

SetWriteNotified allows to set an instance to notify when a write happens. It must be used during initialization. It is not safe to use it during execution.

func (*DB) StartTime

func (db *DB) StartTime() (int64, error)

StartTime implements the Storage interface.

type Options

type Options struct {
	// Segments (wal files) max size.
	// WALSegmentSize <= 0, segment size is default size.
	// WALSegmentSize > 0, segment size is WALSegmentSize.
	WALSegmentSize int

	// WALCompression configures the compression type to use on records in the WAL.
	WALCompression wlog.CompressionType

	// StripeSize is the size (power of 2) in entries of the series hash map. Reducing the size will save memory but impact performance.
	StripeSize int

	// TruncateFrequency determines how frequently to truncate data from the WAL.
	TruncateFrequency time.Duration

	// Shortest and longest amount of time data can exist in the WAL before being
	// deleted.
	MinWALTime, MaxWALTime int64

	// NoLockfile disables creation and consideration of a lock file.
	NoLockfile bool

	// OutOfOrderTimeWindow specifies how much out of order is allowed, if any.
	OutOfOrderTimeWindow int64
}

Options of the WAL storage.

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions used for the WAL storage. They are reasonable for setups using millisecond-precision timestamps.

Jump to

Keyboard shortcuts

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