Documentation ¶
Index ¶
- Constants
- func AggregateWithFuncType(data types.MetricData, function string) types.MetricData
- func InternalDecodePoints(buffer []byte) ([]types.MetricPoint, error)
- func RequestUseAggregatedData(request types.MetricRequest) bool
- type CassandraTSDB
- func (c *CassandraTSDB) ForcePreAggregation(ctx context.Context, threadCount int, from time.Time, to time.Time, ...) error
- func (c *CassandraTSDB) InternalWrite(ctx context.Context, metrics []types.MetricData, writingTimestamp int64) error
- func (c *CassandraTSDB) InternalWriteAggregated(ctx context.Context, metrics []aggregate.AggregatedData, ...) error
- func (c *CassandraTSDB) ReadIter(ctx context.Context, request types.MetricRequest) (types.MetricDataSet, error)
- func (c *CassandraTSDB) Start(_ context.Context) error
- func (c *CassandraTSDB) Stop() error
- func (c *CassandraTSDB) Write(ctx context.Context, metrics []types.MetricData) error
- type Options
Constants ¶
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:
- a bug caused the normal pre-aggregation to have anormal result
- 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 ¶
func (c *CassandraTSDB) ReadIter(ctx context.Context, request types.MetricRequest) (types.MetricDataSet, error)
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.