Documentation ¶
Index ¶
- func FetchOptionsToM3Options(fetchOptions *FetchOptions, fetchQuery *FetchQuery) index.QueryOptions
- func FetchQueryToM3Query(fetchQuery *FetchQuery, cache *QueryConversionCache) (index.Query, error)
- func FetchResultToBlockResult(result *FetchResult, query *FetchQuery, lookbackDuration time.Duration, ...) (block.Result, error)
- func FetchResultToPromResult(result *FetchResult) *prompb.QueryResult
- func FromIdentTagIteratorToTags(identTags ident.TagIterator, tagOptions models.TagOptions) (models.Tags, error)
- func FromM3IdentToMetric(identID ident.ID, iterTags ident.TagIterator, tagOptions models.TagOptions) (models.Metric, error)
- func NewMultiBlockWrapper(unconsolidatedBlock block.UnconsolidatedBlock) block.Block
- func NewMultiSeriesBlock(seriesList ts.SeriesList, query *FetchQuery, lookbackDuration time.Duration) (block.UnconsolidatedBlock, error)
- func NewUnconsolidatedStep(time time.Time, values []ts.Datapoints) block.UnconsolidatedStep
- func PromLabelsToM3Tags(labels []*prompb.Label, tagOptions models.TagOptions) models.Tags
- func PromMatcherToM3(matcher *prompb.LabelMatcher) (models.Matcher, error)
- func PromMatchersToM3(matchers []*prompb.LabelMatcher) (models.Matchers, error)
- func PromSamplesToM3Datapoints(samples []*prompb.Sample) ts.Datapoints
- func PromTypeToM3(labelType prompb.LabelMatcher_Type) (models.MatchType, error)
- func SeriesToPromSamples(series *ts.Series) []*prompb.Sample
- func SeriesToPromTS(series *ts.Series) prompb.TimeSeries
- func TagsToIdentTagIterator(tags models.Tags) ident.TagIterator
- func TagsToPromLabels(tags models.Tags) []*prompb.Label
- func TimeToTimestamp(timestamp time.Time) int64
- func TimestampToTime(timestampMS int64) time.Time
- func ValidateMetricsType(v MetricsType) error
- type Appender
- type Attributes
- type CompleteTagsQuery
- type CompleteTagsResult
- type CompleteTagsResultBuilder
- type CompletedTag
- type FanoutOption
- type FanoutOptions
- type FetchOptions
- type FetchQuery
- type FetchResult
- type MetricsType
- type Querier
- type Query
- type QueryConversionCache
- type QueryConversionLRU
- type QueryResult
- type SearchResults
- type SeriesMatchQuery
- type Storage
- type Type
- type WriteQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchOptionsToM3Options ¶
func FetchOptionsToM3Options(fetchOptions *FetchOptions, fetchQuery *FetchQuery) index.QueryOptions
FetchOptionsToM3Options converts a set of coordinator options to M3 options
func FetchQueryToM3Query ¶
func FetchQueryToM3Query(fetchQuery *FetchQuery, cache *QueryConversionCache) (index.Query, error)
FetchQueryToM3Query converts an m3coordinator fetch query to an M3 query
func FetchResultToBlockResult ¶
func FetchResultToBlockResult(result *FetchResult, query *FetchQuery, lookbackDuration time.Duration, enforcer cost.ChainedEnforcer) (block.Result, error)
FetchResultToBlockResult converts a fetch result into coordinator blocks
func FetchResultToPromResult ¶
func FetchResultToPromResult(result *FetchResult) *prompb.QueryResult
FetchResultToPromResult converts fetch results from M3 to Prometheus result. TODO(rartoul): We should pool all of these intermediary datastructures, or at least the []*prompb.Sample (as thats the most heavily allocated object) since we have full control over the lifecycle.
func FromIdentTagIteratorToTags ¶
func FromIdentTagIteratorToTags( identTags ident.TagIterator, tagOptions models.TagOptions, ) (models.Tags, error)
FromIdentTagIteratorToTags converts ident tags to coordinator tags
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 NewMultiBlockWrapper ¶ added in v0.4.6
func NewMultiBlockWrapper(unconsolidatedBlock block.UnconsolidatedBlock) block.Block
NewMultiBlockWrapper returns a block wrapper over an unconsolidated block
func NewMultiSeriesBlock ¶ added in v0.4.6
func NewMultiSeriesBlock(seriesList ts.SeriesList, query *FetchQuery, lookbackDuration time.Duration) (block.UnconsolidatedBlock, error)
NewMultiSeriesBlock returns a new unconsolidated block
func NewUnconsolidatedStep ¶ added in v0.5.0
func NewUnconsolidatedStep( time time.Time, values []ts.Datapoints, ) block.UnconsolidatedStep
NewUnconsolidatedStep returns an unconsolidated step with given values.
func PromLabelsToM3Tags ¶
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 PromTypeToM3 ¶
func PromTypeToM3(labelType prompb.LabelMatcher_Type) (models.MatchType, error)
PromTypeToM3 converts a prometheus label type to m3 matcher type
func SeriesToPromSamples ¶
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 ¶
TagsToPromLabels converts tags to prometheus labels.
func TimeToTimestamp ¶
TimeToTimestamp converts a time.Time to prometheus timestamp
func TimestampToTime ¶
TimestampToTime converts a prometheus timestamp to time.Time
func ValidateMetricsType ¶
func ValidateMetricsType(v MetricsType) error
ValidateMetricsType validates a stored metrics type.
Types ¶
type Appender ¶
type Appender interface { // Write value to the database for an ID Write(ctx context.Context, query *WriteQuery) error }
Appender provides batched appends against a storage.
type Attributes ¶
type Attributes struct { MetricsType MetricsType Retention time.Duration Resolution time.Duration }
Attributes is a set of stored metrics attributes.
type CompleteTagsQuery ¶ added in v0.4.8
type CompleteTagsQuery struct { CompleteNameOnly bool FilterNameTags [][]byte TagMatchers models.Matchers }
CompleteTagsQuery represents a query that returns an autocompleted set of tags that exist in the db
func (*CompleteTagsQuery) String ¶ added in v0.4.8
func (q *CompleteTagsQuery) String() string
type CompleteTagsResult ¶ added in v0.4.8
type CompleteTagsResult struct { CompleteNameOnly bool CompletedTags []CompletedTag }
CompleteTagsResult represents a set of autocompleted tag names and values
type CompleteTagsResultBuilder ¶ added in v0.4.8
type CompleteTagsResultBuilder interface { Add(*CompleteTagsResult) error Build() CompleteTagsResult }
CompleteTagsResultBuilder is a builder that accumulates and deduplicates incoming CompleteTagsResult values
func NewCompleteTagsResultBuilder ¶ added in v0.4.8
func NewCompleteTagsResultBuilder( nameOnly bool, ) CompleteTagsResultBuilder
NewCompleteTagsResultBuilder creates a new complete tags result builder.
type CompletedTag ¶ added in v0.4.8
CompletedTag is an autocompleted tag with a name and a list of possible values
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 { // Limit is the maximum number of series to return. Limit 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 // Enforcer is used to enforce resource limits on the number of datapoints // used by a given query. Limits are imposed at time of decompression. Enforcer cost.ChainedEnforcer // Scope is used to report metrics about the fetch. Scope tally.Scope }
FetchOptions represents the options for fetch query.
func NewFetchOptions ¶ added in v0.4.8
func NewFetchOptions() *FetchOptions
NewFetchOptions creates a new fetch options.
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
type FetchResult ¶
type FetchResult struct { SeriesList ts.SeriesList // The aggregated list of results across all underlying storage calls LocalOnly bool HasNext bool }
FetchResult provides a fetch result and meta information
func SeriesIteratorsToFetchResult ¶
func SeriesIteratorsToFetchResult( seriesIterators encoding.SeriesIterators, readWorkerPool xsync.PooledWorkerPool, cleanupSeriesIters bool, enforcer cost.ChainedEnforcer, tagOptions models.TagOptions, ) (*FetchResult, error)
SeriesIteratorsToFetchResult converts SeriesIterators into a fetch result
type MetricsType ¶
type MetricsType uint
MetricsType is a type of stored metrics.
const ( // UnaggregatedMetricsType is an unaggregated metrics type. UnaggregatedMetricsType MetricsType = iota // AggregatedMetricsType is an aggregated metrics type. AggregatedMetricsType // DefaultMetricsType is the default metrics type value. DefaultMetricsType = UnaggregatedMetricsType )
func (MetricsType) String ¶
func (t MetricsType) String() string
func (*MetricsType) UnmarshalYAML ¶
func (v *MetricsType) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals a stored merics type.
type Querier ¶
type Querier interface { // Fetch fetches timeseries data based on a query Fetch( ctx context.Context, query *FetchQuery, options *FetchOptions, ) (*FetchResult, error) // FetchBlocks converts fetch results to storage blocks FetchBlocks( ctx context.Context, query *FetchQuery, options *FetchOptions, ) (block.Result, error) // FetchTags returns search results for tags FetchTags( ctx context.Context, query *FetchQuery, options *FetchOptions, ) (*SearchResults, error) // CompleteTags returns autocompleted tag results CompleteTags( ctx context.Context, query *CompleteTagsQuery, options *FetchOptions, ) (*CompleteTagsResult, error) }
Querier handles queries against a storage.
type QueryConversionCache ¶ added in v0.7.0
type QueryConversionCache struct {
// contains filtered or unexported fields
}
QueryConversionCache represents the query conversion LRU cache
func NewQueryConversionCache ¶ added in v0.7.0
func NewQueryConversionCache(lru *QueryConversionLRU) *QueryConversionCache
NewQueryConversionCache creates a new QueryConversionCache with a provided LRU cache
type QueryConversionLRU ¶ added in v0.7.0
type QueryConversionLRU struct {
// contains filtered or unexported fields
}
QueryConversionLRU implements a fixed size LRU cache
func NewQueryConversionLRU ¶ added in v0.7.0
func NewQueryConversionLRU(size int) (*QueryConversionLRU, error)
NewQueryConversionLRU constructs an LRU of the given size
type QueryResult ¶
type QueryResult struct { FetchResult *FetchResult Err error }
QueryResult is the result from a query
type SearchResults ¶
SearchResults is the result from a search
type SeriesMatchQuery ¶ added in v0.5.0
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 }
Storage provides an interface for reading and writing to the tsdb
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 // TypeDebug is for storages that are used for debugging purposes TypeDebug )
type WriteQuery ¶
type WriteQuery struct { Tags models.Tags Datapoints ts.Datapoints Unit xtime.Unit Annotation []byte Attributes Attributes }
WriteQuery represents the input timeseries that is written to the db
func PromWriteTSToM3 ¶
func PromWriteTSToM3( timeseries *prompb.TimeSeries, opts models.TagOptions, ) *WriteQuery
PromWriteTSToM3 converts a prometheus write query to an M3 one
func (*WriteQuery) String ¶
func (q *WriteQuery) String() string