Documentation ¶
Index ¶
- Variables
- func IsValid(ln string) bool
- type Bounds
- func (b Bounds) Blocks(t xtime.UnixNano) int
- func (b Bounds) Contains(t xtime.UnixNano) bool
- func (b Bounds) End() xtime.UnixNano
- func (b Bounds) Equals(other Bounds) bool
- func (b Bounds) Nearest(t xtime.UnixNano) Bounds
- func (b Bounds) Next(n int) Bounds
- func (b Bounds) Previous(n int) Bounds
- func (b Bounds) Steps() int
- func (b Bounds) String() string
- func (b Bounds) TimeForIndex(idx int) (xtime.UnixNano, error)
- type FetchedBlockType
- type Filter
- type Filters
- type FormatType
- type IDSchemeType
- type MatchType
- type Matcher
- type Matchers
- type Metric
- type Metrics
- type QueryContext
- type QueryContextOptions
- type RequestParams
- type RestrictFetchTypeQueryContextOptions
- type Tag
- type TagOptions
- type Tags
- func (t Tags) Add(other Tags) Tags
- func (t Tags) AddOrUpdateTag(tag Tag) Tags
- func (t Tags) AddTag(tag Tag) Tags
- func (t Tags) AddTagWithoutNormalizing(tag Tag) Tags
- func (t Tags) AddTags(tags []Tag) Tags
- func (t Tags) AddTagsIfNotExists(tags []Tag) Tags
- func (t Tags) Bucket() ([]byte, bool)
- func (t Tags) Clone() Tags
- func (t Tags) Equals(other Tags) bool
- func (t Tags) Get(key []byte) ([]byte, bool)
- func (t Tags) HashedID() uint64
- func (t Tags) ID() []byte
- func (t *Tags) LastComputedHashedID() uint64
- func (t *Tags) LastComputedID() []byte
- func (t Tags) Len() int
- func (t Tags) Less(i, j int) bool
- func (t Tags) Name() ([]byte, bool)
- func (t Tags) Normalize() Tags
- func (t Tags) Reset() Tags
- func (t Tags) SetBucket(value []byte) Tags
- func (t Tags) SetName(value []byte) Tags
- func (t Tags) String() string
- func (t Tags) Swap(i, j int)
- func (t Tags) TagsWithKeys(includeKeys [][]byte) Tags
- func (t Tags) TagsWithoutKeys(excludeKeys [][]byte) Tags
- func (t Tags) Validate() error
- func (t Tags) WithoutName() Tags
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMultiBlockDisabled indicates multi blocks are temporarily disabled. ErrMultiBlockDisabled = fmt.Errorf("multiblock is temporarily disabled %s", infoMsg) )
Functions ¶
Types ¶
type Bounds ¶ added in v0.4.4
Bounds are the time bounds, start time is inclusive but end is exclusive.
func (Bounds) Previous ¶ added in v0.4.4
Previous returns the nth previous bound from the current bound.
type FetchedBlockType ¶ added in v0.5.0
type FetchedBlockType uint8
FetchedBlockType determines the type for fetched blocks, and how they are transformed from storage type.
const ( // TypeSingleBlock represents a single block which contains each encoded fetched // series. Default block type for Prometheus queries. TypeSingleBlock FetchedBlockType = iota // TypeMultiBlock represents multiple blocks, each containing a time-based slice // of encoded fetched series. Default block type for non-Prometheus queries. // // NB: Currently disabled. TypeMultiBlock )
func (FetchedBlockType) Validate ¶ added in v0.5.0
func (t FetchedBlockType) Validate() error
Validate validates the fetched block type.
type Filter ¶ added in v0.15.5
type Filter struct { // Name is the name of the series. Name []byte // Values are a set of filter values. If this is unset, all series containing // the tag name are filtered. Values [][]byte }
Filter is a regex tag filter.
type FormatType ¶ added in v0.5.0
type FormatType int
FormatType describes what format to return the data in.
const ( // FormatPromQL returns results in Prom format FormatPromQL FormatType = iota )
type IDSchemeType ¶ added in v0.5.0
type IDSchemeType uint16
IDSchemeType determines the scheme for generating series IDs based on their tags.
const ( // TypeDefault is an invalid scheme that indicates that the default scheme // for the tag options version option should be used. TypeDefault IDSchemeType = iota // TypeQuoted describes a scheme where IDs are generated by appending // tag names with explicitly quoted and escaped tag values. Tag names are // also escaped if they contain invalid characters. This is equivalent to // the Prometheus ID style. // {t1:v1},{t2:v2} -> {t1="v1",t2="v2"} // {t1:v1,t2:v2} -> {t1="v1,t2:v2"} // {"t1":"v1"} -> {\"t1\""="\"v1\""} TypeQuoted // TypePrependMeta describes a scheme where IDs are generated by prepending // the length of each tag at the start of the ID // {t1:v1},{t2:v2} -> 2,2,2,2!t1v1t2v2 // {t1:v1,t2:v2} -> 2,8!t1v1,t2:v2 // {"t1":"v1"} -> 4,4!"t1""v1" TypePrependMeta // TypeGraphite describes a scheme where IDs are generated to match graphite // representation of the tags. This scheme should only be used on the graphite // ingestion path, as it ignores tag names and is very prone to collisions if // used on non-graphite data. // {__g0__:v1},{__g1__:v2} -> v1.v2 // // NB: when TypeGraphite is specified, tags are ordered numerically rather // than lexically. // // NB 2: while the graphite scheme is valid, it is not available to choose as // a general ID scheme; instead, it is set on any metric coming through the // graphite ingestion path. TypeGraphite )
func (IDSchemeType) String ¶ added in v0.5.0
func (t IDSchemeType) String() string
func (*IDSchemeType) UnmarshalYAML ¶ added in v0.5.0
func (t *IDSchemeType) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals a stored merics type.
func (IDSchemeType) Validate ¶ added in v0.5.0
func (t IDSchemeType) Validate() error
Validate validates that the scheme type is valid.
type MatchType ¶
type MatchType int
MatchType is an enum for label matching types.
type Matcher ¶
type Matcher struct { Type MatchType `json:"type"` Name []byte `json:"name"` Value []byte `json:"value"` // contains filtered or unexported fields }
Matcher models the matching of a label. NB: when serialized to JSON, name and value will be in base64.
func NewMatcher ¶
NewMatcher returns a matcher object.
type Matchers ¶
type Matchers []Matcher
Matchers is a list of individual matchers.
func MatchersFromString ¶ added in v0.5.0
MatchersFromString parses a string into Matchers TODO: make this more robust, handle types other than MatchEqual
type QueryContext ¶ added in v0.7.0
type QueryContext struct { Ctx context.Context Scope tally.Scope Options QueryContextOptions }
QueryContext provides all external state needed to execute and track a query.
func NewQueryContext ¶ added in v0.7.0
func NewQueryContext( ctx context.Context, scope tally.Scope, options QueryContextOptions, ) *QueryContext
NewQueryContext constructs a QueryContext from the provided native context.
func NoopQueryContext ¶ added in v0.7.0
func NoopQueryContext() *QueryContext
NoopQueryContext returns a query context with no active components.
func (*QueryContext) WithContext ¶ added in v0.7.0
func (qc *QueryContext) WithContext(ctx context.Context) *QueryContext
WithContext creates a shallow copy of this QueryContext using the new context. Sample usage:
ctx, cancel := context.WithTimeout(qc.Ctx, 5*time.Second) defer cancel() qc = qc.WithContext(ctx)
type QueryContextOptions ¶ added in v0.9.2
type QueryContextOptions struct { // LimitMaxTimeseries limits the number of time series returned by each // storage node. LimitMaxTimeseries int // LimitMaxDocs limits the number of docs returned by each storage node. LimitMaxDocs int // LimitMaxReturnedSeries limits the number of series returned in total to the client. LimitMaxReturnedSeries int // LimitMaxReturnedDatapoints limits the number of datapoints returned in total to the client. LimitMaxReturnedDatapoints int // LimitMaxReturnedSeriesMetadata limits the number of series metadata returned in total to the client. LimitMaxReturnedSeriesMetadata int // RequireExhaustive results in an error if the query exceeds the series limit. RequireExhaustive bool // Instantaneous indicates an instant query. Instantaneous bool // RestrictFetchType restricts the query fetches. RestrictFetchType *RestrictFetchTypeQueryContextOptions }
QueryContextOptions contains optional configuration for the query context.
type RequestParams ¶
type RequestParams struct { Start xtime.UnixNano End xtime.UnixNano // Now captures the current time and fixes it throughout the request, we // may let people override it in the future. Now time.Time Timeout time.Duration Step time.Duration Query string Debug bool KeepNans bool IncludeEnd bool BlockType FetchedBlockType FormatType FormatType LookbackDuration time.Duration }
RequestParams represents the params from the request.
func (RequestParams) ExclusiveEnd ¶ added in v0.4.1
func (r RequestParams) ExclusiveEnd() xtime.UnixNano
ExclusiveEnd returns the end exclusive.
type RestrictFetchTypeQueryContextOptions ¶ added in v0.11.0
type RestrictFetchTypeQueryContextOptions struct { MetricsType uint StoragePolicy policy.StoragePolicy }
RestrictFetchTypeQueryContextOptions allows for specifying the restrict options for a query.
type Tag ¶ added in v0.4.2
Tag is a key/value metric tag pair.
func TagsFromProto ¶ added in v0.15.11
TagsFromProto converts proto tags to models.Tags.
func (Tag) Equals ¶ added in v0.11.0
Equals returns a boolean indicating whether the provided tags are equal.
NB: does not check that compared tags have the same underlying bytes.
type TagOptions ¶ added in v0.4.8
type TagOptions interface { // Validate validates these tag options. Validate() error // SetMetricName sets the name for the `metric name` tag. SetMetricName(value []byte) TagOptions // MetricName gets the name for the `metric name` tag. MetricName() []byte // SetBucketName sets the name for the `bucket label` tag. SetBucketName(value []byte) TagOptions // BucketName gets the name for the `bucket label` tag. BucketName() []byte // SetIDSchemeType sets the ID generation scheme type. SetIDSchemeType(value IDSchemeType) TagOptions // IDSchemeType gets the ID generation scheme type. IDSchemeType() IDSchemeType // SetFilters sets tag filters. SetFilters(value Filters) TagOptions // Filters gets the tag filters. Filters() Filters // SetAllowTagNameDuplicates sets the value to allow duplicate tags to appear. SetAllowTagNameDuplicates(value bool) TagOptions // AllowTagNameDuplicates returns the value to allow duplicate tags to appear. AllowTagNameDuplicates() bool // SetAllowTagValueEmpty sets the value to allow empty tag values to appear. SetAllowTagValueEmpty(value bool) TagOptions // AllowTagValueEmpty returns the value to allow empty tag values to appear. AllowTagValueEmpty() bool // Equals determines if two tag options are equivalent. Equals(other TagOptions) bool }
TagOptions describes additional options for tags.
func NewTagOptions ¶ added in v0.4.8
func NewTagOptions() TagOptions
NewTagOptions builds a new tag options with default values.
type Tags ¶
type Tags struct { Opts TagOptions Tags []Tag // contains filtered or unexported fields }
Tags represents a set of tags with options.
func EmptyTags ¶ added in v0.4.2
func EmptyTags() Tags
EmptyTags returns empty tags with a default tag options.
func MustMakeTags ¶ added in v0.11.0
MustMakeTags creates tags given that the number of args is even.
func NewTags ¶ added in v0.4.8
func NewTags(size int, opts TagOptions) Tags
NewTags builds a tags with the given size and tag options.
func (Tags) AddOrUpdateTag ¶ added in v0.4.8
AddOrUpdateTag is used to add a single tag and maintain sorted order, or to replace the value of an existing tag.
func (Tags) AddTagWithoutNormalizing ¶ added in v0.5.0
AddTagWithoutNormalizing is used to add a single tag.
func (Tags) AddTags ¶ added in v0.4.8
AddTags is used to add a list of tags and maintain sorted order.
func (Tags) AddTagsIfNotExists ¶ added in v0.14.0
AddTagsIfNotExists is used to add a list of tags with unique names and maintain sorted order.
func (Tags) Equals ¶ added in v0.11.0
Equals returns a boolean reporting whether the compared tags have the same values.
NB: does not check that compared tags have the same underlying bytes.
func (Tags) ID ¶
ID returns a byte slice representation of the tags, using the generation strategy from the tag options.
func (*Tags) LastComputedHashedID ¶ added in v0.15.2
LastComputedHashedID returns the last computed hashed ID; this should only be used when it is guaranteed that no tag transforms take place between calls.
func (*Tags) LastComputedID ¶ added in v0.15.2
LastComputedID returns the last computed ID; this should only be used when it is guaranteed that no tag transforms take place between calls.
func (Tags) Normalize ¶ added in v0.4.8
Normalize normalizes the tags by sorting them in place. In the future, it might also ensure other things like uniqueness.
func (Tags) TagsWithKeys ¶ added in v0.4.2
TagsWithKeys returns only the tags which have the given keys.
func (Tags) TagsWithoutKeys ¶ added in v0.4.2
TagsWithoutKeys returns only the tags which do not have the given keys.
func (Tags) Validate ¶ added in v0.15.0
Validate will validate there are tag values, and the tags are ordered and there are no duplicates.
func (Tags) WithoutName ¶
WithoutName copies the tags excluding the name tag.