tsdb

package
v0.0.0-...-2a93a25 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const MaxPastDelay = 8 * time.Hour

MaxPastDelay is the maximum delay in the past a points could be write without aggregated data issue. Any point wrote with a timestamp more than MaxPastDelay in the past is likely to be ignored in aggregated data. This delay will also force the aggregation to run after 0h00 UTC + MaxPastDelay (since we check often, it will start at this time).

Variables

This section is empty.

Functions

func AggregateWithFuncType

func AggregateWithFuncType(data types.MetricData, function string) types.MetricData

AggregateWithFuncType aggregates the given data, handling each point according to the given promql function.

func InternalDecodePoints

func InternalDecodePoints(buffer []byte) ([]types.MetricPoint, error)

InternalDecodePoints is an internal function to decode points. You should not rely on this function and it might change without warning. Used for squirreldb_debig_tools.

func RequestUseAggregatedData

func RequestUseAggregatedData(request types.MetricRequest) bool

RequestUseAggregatedData returns whether a request will try to use aggregated data or only raw data. A request may always use some raw data if querying recent time range.

Types

type CassandraTSDB

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

func New

func New(
	ctx context.Context,
	reg prometheus.Registerer,
	connection *connection.Connection,
	options Options,
	index types.Index,
	lockFactory lockFactory,
	state types.State,
	logger zerolog.Logger,
) (*CassandraTSDB, error)

New created a new CassandraTSDB object.

func (*CassandraTSDB) ForcePreAggregation

func (c *CassandraTSDB) ForcePreAggregation(
	ctx context.Context,
	threadCount int,
	from time.Time, to time.Time,
	matchers []*labels.Matcher,
) error

ForcePreAggregation will pre-aggregate all metrics between two given time The forced pre-aggregation will run even if data are already pre-aggregated and will not change the stored position where pre-aggregation think it stopped. The from & to will be extended to be aligned with the aggregation size. Metrics will be filtered by labels if `matchers` is not nil.

Forcing pre-aggregation should only serve when:

  1. a bug caused the normal pre-aggregation to have anormal result
  2. data were inserted with too many delay and normal pre-aggregation already processed the time range.

func (*CassandraTSDB) InternalWrite

func (c *CassandraTSDB) InternalWrite(ctx context.Context, metrics []types.MetricData, writingTimestamp int64) error

InternalWrite writes all specified metrics as aggregated data This method should only by used for benchmark/tests or bulk import. Metric points should be sorted in ascending order and deduplicated. If writingTimestamp is not 0, it's the timestamp used to write in Cassandra (in microseconds since epoc).

func (*CassandraTSDB) InternalWriteAggregated

func (c *CassandraTSDB) InternalWriteAggregated(
	ctx context.Context,
	metrics []aggregate.AggregatedData,
	writingTimestamp int64,
) error

InternalWriteAggregated writes all specified metrics as aggregated data This method should only by used for benchmark/tests or bulk import. This will replace data for given aggregated row (based on timestamp of first time). Points in each AggregatedData MUST be sorted in ascending order. Also if writingTimestamp is not 0, it's the timestamp used to write in Cassandra (in microseconds since epoc).

func (*CassandraTSDB) ReadIter

ReadIter returns metrics according to the request made.

func (*CassandraTSDB) Start

func (c *CassandraTSDB) Start(_ context.Context) error

Start starts all Cassandra Index services.

func (*CassandraTSDB) Stop

func (c *CassandraTSDB) Stop() error

Stop stop and wait all Cassandra Index services.

func (*CassandraTSDB) Write

func (c *CassandraTSDB) Write(ctx context.Context, metrics []types.MetricData) error

Write writes all specified metrics. Metric points should be sorted in ascending order and deduplicated.

type Options

type Options struct {
	SchemaLock                sync.Locker
	DefaultTimeToLive         time.Duration
	AggregateIntendedDuration func() time.Duration
	ReadOnly                  bool
	DisablePreAggregation     bool
}

Jump to

Keyboard shortcuts

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