models

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2018 License: Apache-2.0 Imports: 5 Imported by: 88

Documentation

Index

Constants

View Source
const (
	// MetricName is an internal name used to denote the name of the metric.
	// TODO: Get these from the storage
	MetricName = "__name__"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MatchType

type MatchType int

MatchType is an enum for label matching types.

const (
	MatchEqual MatchType = iota
	MatchNotEqual
	MatchRegexp
	MatchNotRegexp
)

Possible MatchTypes.

func (MatchType) String

func (m MatchType) String() string

type Matcher

type Matcher struct {
	Type  MatchType `json:"type"`
	Name  string    `json:"name"`
	Value string    `json:"value"`
	// contains filtered or unexported fields
}

Matcher models the matching of a label.

func NewMatcher

func NewMatcher(t MatchType, n, v string) (*Matcher, error)

NewMatcher returns a matcher object.

func (*Matcher) Matches

func (m *Matcher) Matches(s string) bool

Matches returns whether the matcher matches the given string value.

func (*Matcher) String

func (m *Matcher) String() string

type Matchers

type Matchers []*Matcher

Matchers is of matchers

func (Matchers) ToTags

func (m Matchers) ToTags() (Tags, error)

ToTags converts Matchers to Tags NB (braskin): this only works for exact matches

type Metric

type Metric struct {
	Namespace string
	ID        string
	Tags      Tags
}

Metric is the individual metric that gets returned from the search endpoint

type Metrics

type Metrics []*Metric

Metrics is a list of individual metrics

type RequestParams

type RequestParams struct {
	Start time.Time
	End   time.Time
	// 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
	IncludeEnd bool
}

RequestParams represents the params from the request

func (RequestParams) ExclusiveEnd added in v0.4.1

func (r RequestParams) ExclusiveEnd() time.Time

ExclusiveEnd returns the end exclusive

type Tag added in v0.4.2

type Tag struct {
	Name, Value string
}

Tag is a key/value metric tag pair

type Tags

type Tags []Tag

Tags is a list of key/value metric tag pairs

func EmptyTags added in v0.4.2

func EmptyTags() Tags

EmptyTags returns empty model tags

func FromMap added in v0.4.2

func FromMap(m map[string]string) Tags

FromMap returns new sorted tags from the given map.

func Normalize added in v0.4.2

func Normalize(tags Tags) Tags

Normalize normalizes the tags by sorting them in place. In future, it might also ensure other things like uniqueness

func (Tags) Add added in v0.4.2

func (t Tags) Add(tags Tags) Tags

Add is used to add a list of tags and maintain sorted order

func (Tags) AddTag added in v0.4.3

func (t Tags) AddTag(tag Tag) Tags

AddTag is used to add a single tag and maintain sorted order

func (Tags) Clone added in v0.4.3

func (t Tags) Clone() Tags

Clone returns a copy of the tags

func (Tags) Get added in v0.4.2

func (t Tags) Get(key string) (string, bool)

Get returns the value for the tag with the given name.

func (Tags) ID

func (t Tags) ID() string

ID returns a string representation of the tags

func (Tags) IDWithExcludes

func (t Tags) IDWithExcludes(excludeKeys ...string) uint64

IDWithExcludes returns a string representation of the tags excluding some tag keys

func (Tags) IDWithKeys

func (t Tags) IDWithKeys(includeKeys ...string) uint64

IDWithKeys returns a string representation of the tags only including the given keys

func (Tags) Len added in v0.4.2

func (t Tags) Len() int

func (Tags) Less added in v0.4.2

func (t Tags) Less(i, j int) bool

func (Tags) StringMap added in v0.4.2

func (t Tags) StringMap() map[string]string

StringMap returns a string map of the tags.

func (Tags) Swap added in v0.4.2

func (t Tags) Swap(i, j int)

func (Tags) TagMap added in v0.4.2

func (t Tags) TagMap() map[string]Tag

TagMap returns a tag map of the tags.

func (Tags) TagsWithKeys added in v0.4.2

func (t Tags) TagsWithKeys(includeKeys []string) Tags

TagsWithKeys returns only the tags which have the given keys

func (Tags) TagsWithoutKeys added in v0.4.2

func (t Tags) TagsWithoutKeys(excludeKeys []string) Tags

TagsWithoutKeys returns only the tags which do not have the given keys

func (Tags) WithoutName

func (t Tags) WithoutName() Tags

WithoutName copies the tags excluding the name tag

Jump to

Keyboard shortcuts

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