storage

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2018 License: Apache-2.0 Imports: 16 Imported by: 62

Documentation

Index

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) (index.Query, error)

FetchQueryToM3Query converts an m3coordinator fetch query to an M3 query

func FetchResultToBlockResult

func FetchResultToBlockResult(result *FetchResult, query *FetchQuery) (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

func FromIdentTagIteratorToTags

func FromIdentTagIteratorToTags(identTags ident.TagIterator) (models.Tags, error)

FromIdentTagIteratorToTags converts ident tags to coordinator tags

func FromM3IdentToMetric

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

FromM3IdentToMetric converts an M3 ident metric to a coordinator metric

func PromLabelsToM3Tags

func PromLabelsToM3Tags(labels []*prompb.Label) 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 PromTypeToM3

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

PromTypeToM3 converts a prometheus label type to m3 matcher type

func SeriesToPromSamples

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

SeriesToPromSamples series datapoints to prometheus samples

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 TimeToTimestamp

func TimeToTimestamp(timestamp time.Time) int64

TimeToTimestamp converts a time.Time to prometheus timestamp

func TimestampToTime

func TimestampToTime(timestampMS int64) time.Time

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 FetchOptions

type FetchOptions struct {
	Limit    int
	KillChan chan struct{}
}

FetchOptions represents the options for fetch 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 ready 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,
	workerPools pool.ObjectPool,
) (*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)
}

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 QueryResult

type QueryResult struct {
	FetchResult *FetchResult
	Err         error
}

QueryResult is the result from a query

type SearchResults

type SearchResults struct {
	Metrics models.Metrics
}

SearchResults is the result from a search

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
)

type WriteQuery

type WriteQuery struct {
	Raw        string
	Tags       models.Tags
	Datapoints ts.Datapoints
	Unit       xtime.Unit
	Annotation []byte
	Attributes Attributes
}

WriteQuery represents the input timeseries that is written to M3DB

func PromWriteTSToM3

func PromWriteTSToM3(timeseries *prompb.TimeSeries) *WriteQuery

PromWriteTSToM3 converts a prometheus write query to an M3 one

func (*WriteQuery) String

func (q *WriteQuery) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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