storage

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 28 Imported by: 62

Documentation

Overview

Package storage is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchOptionsToAggregateOptions added in v0.8.0

func FetchOptionsToAggregateOptions(
	fetchOptions *FetchOptions,
	tagQuery *CompleteTagsQuery,
) (index.AggregationOptions, error)

FetchOptionsToAggregateOptions converts a set of coordinator options as well as complete tags query to an M3 aggregate query option.

func FetchOptionsToM3Options

func FetchOptionsToM3Options(
	fetchOptions *FetchOptions,
	fetchQuery *FetchQuery,
) (index.QueryOptions, error)

FetchOptionsToM3Options converts a set of coordinator options to M3 options.

func FetchQueryToM3Query

func FetchQueryToM3Query(
	fetchQuery *FetchQuery,
	options *FetchOptions,
) (index.Query, error)

FetchQueryToM3Query converts an m3coordinator fetch query to an M3 query.

func FetchResultToPromResult

func FetchResultToPromResult(
	result *FetchResult,
	keepEmpty bool,
) *prompb.QueryResult

FetchResultToPromResult converts fetch results from M3 to Prometheus result.

func FromM3IdentToMetric

func FromM3IdentToMetric(
	identID ident.ID,
	iterTags ident.TagIterator,
	tagOptions models.TagOptions,
) (models.Metric, error)

FromM3IdentToMetric converts an M3 ident metric to a coordinator metric.

func IsWarning added in v0.13.0

func IsWarning(store Storage, err error) (bool, error)

IsWarning determines if the given error coming from the storage is a warning, and returns it with appropriate wrapping.

func PromLabelsToM3Tags

func PromLabelsToM3Tags(
	labels []prompb.Label,
	tagOptions models.TagOptions,
) models.Tags

PromLabelsToM3Tags converts Prometheus labels to M3 tags

func PromMatcherToM3

func PromMatcherToM3(matcher *prompb.LabelMatcher) (models.Matcher, error)

PromMatcherToM3 converts a prometheus label matcher to m3 matcher

func PromMatchersToM3

func PromMatchersToM3(matchers []*prompb.LabelMatcher) (models.Matchers, error)

PromMatchersToM3 converts prometheus label matchers to m3 matchers

func PromSamplesToM3Datapoints

func PromSamplesToM3Datapoints(samples []prompb.Sample) ts.Datapoints

PromSamplesToM3Datapoints converts Prometheus samples to M3 datapoints

func PromTimeSeriesToSeriesAttributes added in v0.15.0

func PromTimeSeriesToSeriesAttributes(series prompb.TimeSeries) (ts.SeriesAttributes, error)

PromTimeSeriesToSeriesAttributes extracts the series info from a prometheus timeseries.

func PromTimestampToTime added in v0.10.0

func PromTimestampToTime(timestampMS int64) time.Time

PromTimestampToTime converts a prometheus timestamp to time.Time.

func PromTypeToM3

func PromTypeToM3(labelType prompb.LabelMatcher_Type) (models.MatchType, error)

PromTypeToM3 converts a prometheus label type to m3 matcher type

func SeriesAttributesToAnnotationPayload added in v0.15.17

func SeriesAttributesToAnnotationPayload(seriesAttributes ts.SeriesAttributes) (annotation.Payload, error)

SeriesAttributesToAnnotationPayload converts ts.SeriesAttributes into an annotation.Payload.

func SeriesToPromSamples

func SeriesToPromSamples(series *ts.Series) []prompb.Sample

SeriesToPromSamples series datapoints to prometheus samples.SeriesToPromSamples.

func SeriesToPromTS

func SeriesToPromTS(series *ts.Series) prompb.TimeSeries

SeriesToPromTS converts a series to prometheus timeseries.

func TagsToIdentTagIterator

func TagsToIdentTagIterator(tags models.Tags) ident.TagIterator

TagsToIdentTagIterator converts coordinator tags to ident tags.

func TagsToPromLabels

func TagsToPromLabels(tags models.Tags) []prompb.Label

TagsToPromLabels converts tags to prometheus labels.

func TimeToPromTimestamp added in v0.10.0

func TimeToPromTimestamp(timestamp xtime.UnixNano) int64

TimeToPromTimestamp converts a xtime.UnixNano to prometheus timestamp.

Types

type Appender

type Appender interface {
	// Write writes a batched set of datapoints to storage based on the provided
	// query.
	Write(ctx context.Context, query *WriteQuery) error
}

Appender provides batched appends against a storage.

type CompleteTagsQuery added in v0.4.8

type CompleteTagsQuery struct {
	// CompleteNameOnly indicates if the query should return only tag names, or
	// tag names and values.
	CompleteNameOnly bool
	// FilterNameTags is a list of tags to filter results by. If this is empty, no
	// filtering is applied.
	FilterNameTags [][]byte
	// TagMatchers is the search criteria for the query.
	TagMatchers models.Matchers
	// Start is the inclusive start for the query.
	Start xtime.UnixNano
	// End is the exclusive end for the query.
	End xtime.UnixNano
}

CompleteTagsQuery represents a query that returns an autocompleted set of tags.

func (*CompleteTagsQuery) String added in v0.4.8

func (q *CompleteTagsQuery) String() string

type ErrorBehavior added in v0.13.0

type ErrorBehavior uint8

ErrorBehavior describes what this storage type should do on error. This is used for determining how to proceed when encountering an error in a fanout storage situation.

const (
	// BehaviorFail is for storages that should fail the entire query when queries
	// against this storage fail.
	BehaviorFail ErrorBehavior = iota
	// BehaviorWarn is for storages that should only warn of incomplete results on
	// failure.
	BehaviorWarn
	// BehaviorContainer is for storages that contain substorages. It is necessary
	// to look at the returned error to determine if it's a failing error or
	// a warning error.
	BehaviorContainer
)

func ParseErrorBehavior added in v0.13.0

func ParseErrorBehavior(str string) (ErrorBehavior, error)

ParseErrorBehavior parses an error behavior.

func (ErrorBehavior) String added in v0.13.0

func (e ErrorBehavior) String() string

func (*ErrorBehavior) UnmarshalYAML added in v0.13.0

func (e *ErrorBehavior) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals an error behavior.

type FanoutOption added in v0.5.0

type FanoutOption uint

FanoutOption describes the fanout option.

const (
	// FanoutDefault defaults to the fanout option.
	FanoutDefault FanoutOption = iota
	// FanoutForceDisable forces disabling fanout.
	FanoutForceDisable
	// FanoutForceEnable forces enabling fanout.
	FanoutForceEnable
)

type FanoutOptions added in v0.5.0

type FanoutOptions struct {
	// FanoutUnaggregated describes the fanout options for
	// unaggregated namespaces.
	FanoutUnaggregated FanoutOption
	// FanoutAggregated describes the fanout options for
	// aggregated namespaces.
	FanoutAggregated FanoutOption
	// FanoutAggregatedOptimized describes the fanout options for the
	// aggregated namespace optimization.
	FanoutAggregatedOptimized FanoutOption
}

FanoutOptions describes which namespaces should be fanned out to for the query.

type FetchOptions

type FetchOptions struct {
	// Remote is set when this fetch is originated by a remote grpc call.
	Remote bool
	// SeriesLimit is the maximum number of series to return.
	SeriesLimit int
	// InstanceMultiple is how much to increase the per database instance series limit.
	InstanceMultiple float32
	// DocsLimit is the maximum number of docs to return.
	DocsLimit int
	// RangeLimit is the maximum time range to return.
	RangeLimit time.Duration
	// ReturnedSeriesLimit is the maximum number of series to return.
	ReturnedSeriesLimit int
	// ReturnedDatapointsLimit is the maximum number of datapoints to return.
	ReturnedDatapointsLimit int
	// ReturnedSeriesMetadataLimit is the maximum number of series metadata to return.
	ReturnedSeriesMetadataLimit int
	// RequireExhaustive results in an error if the query exceeds the series limit.
	RequireExhaustive bool
	// RequireNoWait results in an error if the query execution must wait for permits.
	RequireNoWait bool
	// MaxMetricMetadataStats is the maximum number of metric metadata stats to return.
	MaxMetricMetadataStats int
	// BlockType is the block type that the fetch function returns.
	BlockType models.FetchedBlockType
	// FanoutOptions are the options for the fetch namespace fanout.
	FanoutOptions *FanoutOptions
	// RestrictQueryOptions restricts the fetch to a specific set of
	// conditions.
	RestrictQueryOptions *RestrictQueryOptions
	// Step is the configured step size.
	Step time.Duration
	// LookbackDuration if set overrides the default lookback duration.
	LookbackDuration *time.Duration
	// Scope is used to report metrics about the fetch.
	Scope tally.Scope
	// Timeout is the timeout for the request.
	Timeout time.Duration
	// ReadConsistencyLevel defines the read consistency for the fetch.
	ReadConsistencyLevel *topology.ReadConsistencyLevel
	// IterateEqualTimestampStrategy provides the conflict resolution strategy for the same timestamp.
	IterateEqualTimestampStrategy *encoding.IterateEqualTimestampStrategy
	// Source is the source for the query.
	Source []byte

	RelatedQueryOptions *RelatedQueryOptions
}

FetchOptions represents the options for fetch query.

func NewFetchOptions added in v0.4.8

func NewFetchOptions() *FetchOptions

NewFetchOptions creates a new fetch options.

func (*FetchOptions) Clone added in v0.9.2

func (o *FetchOptions) Clone() *FetchOptions

Clone will clone and return the fetch options.

func (*FetchOptions) LookbackDurationOrDefault added in v0.11.0

func (o *FetchOptions) LookbackDurationOrDefault(
	defaultValue time.Duration,
) time.Duration

LookbackDurationOrDefault returns either the default lookback duration or overridden lookback duration if set.

func (*FetchOptions) QueryFetchOptions added in v0.11.0

func (o *FetchOptions) QueryFetchOptions(
	queryCtx *models.QueryContext,
	blockType models.FetchedBlockType,
) (*FetchOptions, error)

QueryFetchOptions returns fetch options for a given query.

type FetchQuery

type FetchQuery struct {
	Raw         string
	TagMatchers models.Matchers `json:"matchers"`
	Start       time.Time       `json:"start"`
	End         time.Time       `json:"end"`
	Interval    time.Duration   `json:"interval"`
}

FetchQuery represents the input query which is fetched from M3DB.

func PromReadQueryToM3

func PromReadQueryToM3(query *prompb.Query) (*FetchQuery, error)

PromReadQueryToM3 converts a prometheus read query to m3 read query

func (*FetchQuery) String

func (q *FetchQuery) String() string

func (*FetchQuery) WithAppliedOptions added in v0.15.0

func (q *FetchQuery) WithAppliedOptions(
	opts *FetchOptions,
) *FetchQuery

WithAppliedOptions returns a copy of the fetch query applied options that restricts the fetch with respect to labels that must be applied.

type FetchResult

type FetchResult struct {
	// SeriesList is the list of decompressed and computed series after fetch
	// query execution.
	SeriesList ts.SeriesList
	// Metadata describes any metadata for the operation.
	Metadata block.ResultMetadata
}

FetchResult provides a decompressed fetch result and meta information.

type MockStorage added in v0.8.0

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

MockStorage is a mock of Storage interface.

func NewMockStorage added in v0.8.0

func NewMockStorage(ctrl *gomock.Controller) *MockStorage

NewMockStorage creates a new mock instance.

func (*MockStorage) Close added in v0.8.0

func (m *MockStorage) Close() error

Close mocks base method.

func (*MockStorage) CompleteTags added in v0.8.0

CompleteTags mocks base method.

func (*MockStorage) EXPECT added in v0.8.0

func (m *MockStorage) EXPECT() *MockStorageMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockStorage) ErrorBehavior added in v0.13.0

func (m *MockStorage) ErrorBehavior() ErrorBehavior

ErrorBehavior mocks base method.

func (*MockStorage) FetchBlocks added in v0.8.0

func (m *MockStorage) FetchBlocks(arg0 context.Context, arg1 *FetchQuery, arg2 *FetchOptions) (block.Result, error)

FetchBlocks mocks base method.

func (*MockStorage) FetchCompressed added in v1.2.0

func (m *MockStorage) FetchCompressed(arg0 context.Context, arg1 *FetchQuery, arg2 *FetchOptions) (consolidators.MultiFetchResult, error)

FetchCompressed mocks base method.

func (*MockStorage) FetchProm added in v0.15.0

func (m *MockStorage) FetchProm(arg0 context.Context, arg1 *FetchQuery, arg2 *FetchOptions) (PromResult, error)

FetchProm mocks base method.

func (*MockStorage) Name added in v0.13.0

func (m *MockStorage) Name() string

Name mocks base method.

func (*MockStorage) QueryStorageMetadataAttributes added in v1.2.0

func (m *MockStorage) QueryStorageMetadataAttributes(arg0 context.Context, arg1, arg2 time.Time, arg3 *FetchOptions) ([]storagemetadata.Attributes, error)

QueryStorageMetadataAttributes mocks base method.

func (*MockStorage) SearchSeries added in v0.8.0

func (m *MockStorage) SearchSeries(arg0 context.Context, arg1 *FetchQuery, arg2 *FetchOptions) (*SearchResults, error)

SearchSeries mocks base method.

func (*MockStorage) Type added in v0.8.0

func (m *MockStorage) Type() Type

Type mocks base method.

func (*MockStorage) Write added in v0.8.0

func (m *MockStorage) Write(arg0 context.Context, arg1 *WriteQuery) error

Write mocks base method.

type MockStorageMockRecorder added in v0.8.0

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

MockStorageMockRecorder is the mock recorder for MockStorage.

func (*MockStorageMockRecorder) Close added in v0.8.0

func (mr *MockStorageMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockStorageMockRecorder) CompleteTags added in v0.8.0

func (mr *MockStorageMockRecorder) CompleteTags(arg0, arg1, arg2 interface{}) *gomock.Call

CompleteTags indicates an expected call of CompleteTags.

func (*MockStorageMockRecorder) ErrorBehavior added in v0.13.0

func (mr *MockStorageMockRecorder) ErrorBehavior() *gomock.Call

ErrorBehavior indicates an expected call of ErrorBehavior.

func (*MockStorageMockRecorder) FetchBlocks added in v0.8.0

func (mr *MockStorageMockRecorder) FetchBlocks(arg0, arg1, arg2 interface{}) *gomock.Call

FetchBlocks indicates an expected call of FetchBlocks.

func (*MockStorageMockRecorder) FetchCompressed added in v1.2.0

func (mr *MockStorageMockRecorder) FetchCompressed(arg0, arg1, arg2 interface{}) *gomock.Call

FetchCompressed indicates an expected call of FetchCompressed.

func (*MockStorageMockRecorder) FetchProm added in v0.15.0

func (mr *MockStorageMockRecorder) FetchProm(arg0, arg1, arg2 interface{}) *gomock.Call

FetchProm indicates an expected call of FetchProm.

func (*MockStorageMockRecorder) Name added in v0.13.0

func (mr *MockStorageMockRecorder) Name() *gomock.Call

Name indicates an expected call of Name.

func (*MockStorageMockRecorder) QueryStorageMetadataAttributes added in v1.2.0

func (mr *MockStorageMockRecorder) QueryStorageMetadataAttributes(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

QueryStorageMetadataAttributes indicates an expected call of QueryStorageMetadataAttributes.

func (*MockStorageMockRecorder) SearchSeries added in v0.8.0

func (mr *MockStorageMockRecorder) SearchSeries(arg0, arg1, arg2 interface{}) *gomock.Call

SearchSeries indicates an expected call of SearchSeries.

func (*MockStorageMockRecorder) Type added in v0.8.0

func (mr *MockStorageMockRecorder) Type() *gomock.Call

Type indicates an expected call of Type.

func (*MockStorageMockRecorder) Write added in v0.8.0

func (mr *MockStorageMockRecorder) Write(arg0, arg1 interface{}) *gomock.Call

Write indicates an expected call of Write.

type PromConvertOptions added in v1.4.0

type PromConvertOptions interface {
	// SetResolutionThresholdForCounterNormalization sets resolution
	// starting from which (inclusive) a normalization of counter values is performed.
	SetResolutionThresholdForCounterNormalization(time.Duration) PromConvertOptions

	// ResolutionThresholdForCounterNormalization returns resolution
	// starting from which (inclusive) a normalization of counter values is performed.
	ResolutionThresholdForCounterNormalization() time.Duration

	// SetValueDecreaseTolerance sets relative tolerance against decoded time series value decrease.
	SetValueDecreaseTolerance(value float64) PromConvertOptions

	// ValueDecreaseTolerance returns relative tolerance against decoded time series value decrease.
	ValueDecreaseTolerance() float64

	// SetValueDecreaseToleranceUntil sets the timestamp (exclusive) until which the tolerance applies.
	SetValueDecreaseToleranceUntil(value xtime.UnixNano) PromConvertOptions

	// ValueDecreaseToleranceUntil the timestamp (exclusive) until which the tolerance applies.
	ValueDecreaseToleranceUntil() xtime.UnixNano
}

PromConvertOptions are options controlling the conversion of raw series iterators to a Prometheus-compatible result.

func NewPromConvertOptions added in v1.4.0

func NewPromConvertOptions() PromConvertOptions

NewPromConvertOptions builds a new PromConvertOptions with default values.

type PromResult added in v0.15.0

type PromResult struct {
	// PromResult is the result, in Prometheus protobuf format.
	PromResult *prompb.QueryResult
	// ResultMetadata is the metadata for the result.
	Metadata block.ResultMetadata
}

PromResult is a Prometheus-compatible result type.

func SeriesIteratorsToPromResult added in v0.15.0

func SeriesIteratorsToPromResult(
	ctx context.Context,
	fetchResult consolidators.SeriesFetchResult,
	readWorkerPool xsync.PooledWorkerPool,
	tagOptions models.TagOptions,
	promConvertOptions PromConvertOptions,
	fetchOptions *FetchOptions,
) (PromResult, error)

SeriesIteratorsToPromResult converts raw series iterators directly to a Prometheus-compatible result.

type Querier

type Querier interface {
	// FetchProm fetches decompressed timeseries data based on a query in a
	// Prometheus-compatible format.
	// TODO: take in an accumulator of some sort rather than returning
	// necessarily as a Prom result.
	FetchProm(
		ctx context.Context,
		query *FetchQuery,
		options *FetchOptions,
	) (PromResult, error)

	// FetchBlocks fetches timeseries as blocks based on a query.
	FetchBlocks(
		ctx context.Context,
		query *FetchQuery,
		options *FetchOptions,
	) (block.Result, error)

	FetchCompressed(
		ctx context.Context,
		query *FetchQuery,
		options *FetchOptions,
	) (consolidators.MultiFetchResult, error)

	// SearchSeries returns series IDs matching the current query.
	SearchSeries(
		ctx context.Context,
		query *FetchQuery,
		options *FetchOptions,
	) (*SearchResults, error)

	// CompleteTags returns autocompleted tag results.
	CompleteTags(
		ctx context.Context,
		query *CompleteTagsQuery,
		options *FetchOptions,
	) (*consolidators.CompleteTagsResult, error)

	// QueryStorageMetadataAttributes returns the storage metadata
	// attributes for a query.
	QueryStorageMetadataAttributes(
		ctx context.Context,
		queryStart, queryEnd time.Time,
		opts *FetchOptions,
	) ([]storagemetadata.Attributes, error)
}

Querier handles queries against a storage.

type Query

type Query interface {
	fmt.Stringer
	// contains filtered or unexported methods
}

Query is an interface for a M3DB query.

type QueryTimespan added in v1.4.0

type QueryTimespan struct {
	Start xtime.UnixNano
	End   xtime.UnixNano
}

QueryTimespan represents the start and end time of a query

type RelatedQueryOptions added in v1.4.0

type RelatedQueryOptions struct {
	Timespans []QueryTimespan
}

RelatedQueryOptions describes the timespan of any related queries the client might be making This is used to align the resolution of returned data across all queries.

type RestrictByTag added in v0.15.0

type RestrictByTag struct {
	// Restrict is a set of override matchers to apply to a fetch
	// regardless of the existing fetch matchers, they should replace any
	// existing matchers part of a fetch if they collide.
	Restrict models.Matchers
	// Strip is a set of tag names to strip from the response.
	//
	// NB: If this is unset, but Restrict is set, all tag names appearing in any
	// of the Restrict matchers are removed.
	Strip [][]byte
}

RestrictByTag are specific restrictions to enforce behavior for given tags.

func (*RestrictByTag) GetFilterByNames added in v0.15.0

func (o *RestrictByTag) GetFilterByNames() [][]byte

GetFilterByNames returns the tag names to filter out of the response.

func (*RestrictByTag) GetMatchers added in v0.15.0

func (o *RestrictByTag) GetMatchers() models.Matchers

GetMatchers provides the tag matchers by which results are restricted if present; nil otherwise.

type RestrictByType added in v0.15.0

type RestrictByType struct {
	// MetricsType restricts the type of metrics being returned.
	MetricsType storagemetadata.MetricsType
	// StoragePolicy is required if metrics type is not unaggregated
	// to specify which storage policy metrics should be returned from.
	StoragePolicy policy.StoragePolicy
}

RestrictByType are specific restrictions to stick to a single data type.

func (*RestrictByType) Validate added in v0.15.0

func (o *RestrictByType) Validate() error

Validate will validate the restrict type restrictions.

type RestrictQueryOptions added in v0.15.0

type RestrictQueryOptions struct {
	// RestrictByType are specific restrictions to stick to a single data type.
	RestrictByType *RestrictByType
	// RestrictByTag are specific restrictions to enforce behavior for given
	// tags.
	RestrictByTag *RestrictByTag
	// RestrictByTypes are specific restrictions to query from specified data
	// types.
	RestrictByTypes []*RestrictByType
}

RestrictQueryOptions restricts the query to a specific set of conditions.

func (*RestrictQueryOptions) GetRestrictByTag added in v0.15.0

func (o *RestrictQueryOptions) GetRestrictByTag() *RestrictByTag

GetRestrictByTag provides the tag restrictions if present; nil otherwise.

func (*RestrictQueryOptions) GetRestrictByType added in v0.15.0

func (o *RestrictQueryOptions) GetRestrictByType() *RestrictByType

GetRestrictByType provides the type restrictions if present; nil otherwise.

func (*RestrictQueryOptions) GetRestrictByTypes added in v1.2.0

func (o *RestrictQueryOptions) GetRestrictByTypes() []*RestrictByType

GetRestrictByTypes provides the types restrictions if present; nil otherwise.

func (*RestrictQueryOptions) Validate added in v0.15.0

func (o *RestrictQueryOptions) Validate() error

Validate will validate the restrict fetch options.

type SearchResults

type SearchResults struct {
	// Metrics is the list of search results.
	Metrics models.Metrics
	// Metadata describes any metadata for the Fetch operation.
	Metadata block.ResultMetadata
}

SearchResults is the result from a search.

type SeriesMatchQuery added in v0.5.0

type SeriesMatchQuery struct {
	// TagMatchers is the search criteria for the query.
	TagMatchers []models.Matchers
	// Start is the inclusive start for the query.
	Start time.Time
	// End is the exclusive end for the query.
	End time.Time
}

SeriesMatchQuery represents a query that returns a set of series that match the query.

type Storage

type Storage interface {
	Querier
	Appender
	// Type identifies the type of the underlying storage.
	Type() Type
	// Close is used to close the underlying storage and free up resources.
	Close() error
	// ErrorBehavior dictates what fanout storage should do when this storage
	// encounters an error.
	ErrorBehavior() ErrorBehavior
	// Name gives the plaintext name for this storage, used for logging purposes.
	Name() string
}

Storage provides an interface for reading and writing to the tsdb.

func NewNoopStorage added in v0.15.0

func NewNoopStorage() Storage

NewNoopStorage returns a fake implementation of Storage that rejects all writes and returns errors for all queries.

type Type

type Type int

Type describes the type of storage.

const (
	// TypeLocalDC is for storages that reside in the local datacenter.
	TypeLocalDC Type = iota
	// TypeRemoteDC is for storages that reside in a remote datacenter.
	TypeRemoteDC
	// TypeMultiDC is for storages that will aggregate multiple datacenters.
	TypeMultiDC
)

type WriteQuery

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

WriteQuery represents the input timeseries that is written to the database. TODO: rename WriteQuery to WriteRequest or something similar.

func NewWriteQuery added in v0.15.0

func NewWriteQuery(opts WriteQueryOptions) (*WriteQuery, error)

NewWriteQuery returns a new write query after validating the options.

func (WriteQuery) Annotation

func (q WriteQuery) Annotation() []byte

Annotation returns the annotation.

func (WriteQuery) Attributes

func (q WriteQuery) Attributes() storagemetadata.Attributes

Attributes returns the attributes.

func (WriteQuery) Datapoints

func (q WriteQuery) Datapoints() ts.Datapoints

Datapoints returns the datapoints.

func (WriteQuery) Options added in v0.15.0

func (q WriteQuery) Options() WriteQueryOptions

Options returns the options used to create the write query.

func (*WriteQuery) Reset added in v0.15.0

func (q *WriteQuery) Reset(opts WriteQueryOptions) error

Reset resets the write query for reuse.

func (*WriteQuery) String

func (q *WriteQuery) String() string

func (WriteQuery) Tags

func (q WriteQuery) Tags() models.Tags

Tags returns the tags.

func (WriteQuery) Unit

func (q WriteQuery) Unit() xtime.Unit

Unit returns the unit.

func (*WriteQuery) Validate added in v0.15.0

func (q *WriteQuery) Validate() error

Validate validates the write query.

type WriteQueryOptions added in v0.15.0

type WriteQueryOptions struct {
	Tags       models.Tags
	Datapoints ts.Datapoints
	Unit       xtime.Unit
	Annotation []byte
	Attributes storagemetadata.Attributes
}

WriteQueryOptions is a set of options to use to construct a write query. These are passed by options so that they can be validated when creating a write query, which helps knowing a constructed write query is valid.

func (WriteQueryOptions) Validate added in v0.15.0

func (o WriteQueryOptions) Validate() error

Validate will validate the write query options.

Directories

Path Synopsis
m3
Package m3 is a generated GoMock package.
Package m3 is a generated GoMock package.
Package promremote implements storage interface backed by Prometheus remote write capable endpoints.
Package promremote implements storage interface backed by Prometheus remote write capable endpoints.
promremotetest
Package promremotetest provides test utilities.
Package promremotetest provides test utilities.

Jump to

Keyboard shortcuts

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