model

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AlertNameLabel is the name of the label containing the an alert's name.
	AlertNameLabel = "alertname"

	// ExportedLabelPrefix is the prefix to prepend to the label names present in
	// exported metrics if a label of the same name is added by the server.
	ExportedLabelPrefix = "exported_"

	// MetricNameLabel is the label name indicating the metric name of a
	// timeseries.
	MetricNameLabel = "__name__"

	// SchemeLabel is the name of the label that holds the scheme on which to
	// scrape a target.
	SchemeLabel = "__scheme__"

	// AddressLabel is the name of the label that holds the address of
	// a scrape target.
	AddressLabel = "__address__"

	// MetricsPathLabel is the name of the label that holds the path on which to
	// scrape a target.
	MetricsPathLabel = "__metrics_path__"

	// ScrapeIntervalLabel is the name of the label that holds the scrape interval
	// used to scrape a target.
	ScrapeIntervalLabel = "__scrape_interval__"

	// ScrapeTimeoutLabel is the name of the label that holds the scrape
	// timeout used to scrape a target.
	ScrapeTimeoutLabel = "__scrape_timeout__"

	// ReservedLabelPrefix is a prefix which is not legal in user-supplied
	// label names.
	ReservedLabelPrefix = "__"

	// MetaLabelPrefix is a prefix for labels that provide meta information.
	// Labels with this prefix are used for intermediate label processing and
	// will not be attached to time series.
	MetaLabelPrefix = "__meta_"

	// TmpLabelPrefix is a prefix for temporary labels as part of relabelling.
	// Labels with this prefix are used for intermediate label processing and
	// will not be attached to time series. This is reserved for use in
	// Prometheus configuration files by users.
	TmpLabelPrefix = "__tmp_"

	// ParamLabelPrefix is a prefix for labels that provide URL parameters
	// used to scrape a target.
	ParamLabelPrefix = "__param_"

	// JobLabel is the label name indicating the job from which a timeseries
	// was scraped.
	JobLabel = "job"

	// InstanceLabel is the label name used for the instance label.
	InstanceLabel = "instance"

	// BucketLabel is used for the label that defines the upper bound of a
	// bucket of a histogram ("le" -> "less or equal").
	BucketLabel = "le"

	// QuantileLabel is used for the label that defines the quantile in a
	// summary.
	QuantileLabel = "quantile"

	AppNameLabel       = "__name__"
	ProfileLabelPrefix = "__profile_"
	ProfilePathLabel   = ProfileLabelPrefix + "path__"
	ProfileNameLabel   = ProfileLabelPrefix + "name__"
)
View Source
const (

	// Earliest is the earliest Time representable. Handy for
	// initializing a high watermark.
	Earliest = Time(math.MinInt64)
	// Latest is the latest Time representable. Handy for initializing
	// a low watermark.
	Latest = Time(math.MaxInt64)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration added in v0.8.0

type Duration time.Duration

Duration wraps time.Duration. It is used to parse the custom duration format from YAML. This type should not propagate beyond the scope of input/output processing.

func ParseDuration added in v0.8.0

func ParseDuration(durationStr string) (Duration, error)

ParseDuration parses a string into a time.Duration, assuming that a year always has 365d, a week always has 7d, and a day always has 24h.

func (Duration) MarshalJSON added in v0.8.0

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Duration) MarshalText added in v0.8.0

func (d *Duration) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (Duration) MarshalYAML added in v0.8.0

func (d Duration) MarshalYAML() (interface{}, error)

MarshalYAML implements the yaml.Marshaler interface.

func (*Duration) Set added in v0.8.0

func (d *Duration) Set(s string) error

Set implements pflag/flag.Value

func (Duration) String added in v0.8.0

func (d Duration) String() string

func (*Duration) Type added in v0.8.0

func (*Duration) Type() string

Type implements pflag.Value

func (*Duration) UnmarshalJSON added in v0.8.0

func (d *Duration) UnmarshalJSON(bytes []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Duration) UnmarshalText added in v0.8.0

func (d *Duration) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (*Duration) UnmarshalYAML added in v0.8.0

func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type Interval added in v0.8.0

type Interval struct {
	Start, End Time
}

Interval describes an interval between two timestamps.

type LabelName

type LabelName string

A LabelName is a key for a LabelSet or Metric. It has a value associated therewith.

func (LabelName) IsValid

func (ln LabelName) IsValid() bool

IsValid is true iff the label name matches the pattern of LabelNameRE. This method, however, does not use LabelNameRE for the check but a much faster hardcoded implementation.

func (*LabelName) UnmarshalJSON

func (ln *LabelName) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*LabelName) UnmarshalYAML

func (ln *LabelName) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type LabelNames

type LabelNames []LabelName

LabelNames is a sortable LabelName slice. In implements sort.Interface.

func (LabelNames) Len

func (l LabelNames) Len() int

func (LabelNames) Less

func (l LabelNames) Less(i, j int) bool

func (LabelNames) String

func (l LabelNames) String() string

func (LabelNames) Swap

func (l LabelNames) Swap(i, j int)

type LabelPair

type LabelPair struct {
	Name  LabelName
	Value LabelValue
}

LabelPair pairs a name with a value.

type LabelPairs

type LabelPairs []*LabelPair

LabelPairs is a sortable slice of LabelPair pointers. It implements sort.Interface.

func (LabelPairs) Len

func (l LabelPairs) Len() int

func (LabelPairs) Less

func (l LabelPairs) Less(i, j int) bool

func (LabelPairs) Swap

func (l LabelPairs) Swap(i, j int)

type LabelSet

type LabelSet map[LabelName]LabelValue

A LabelSet is a collection of LabelName and LabelValue pairs. The LabelSet may be fully-qualified down to the point where it may resolve to a single Metric in the data store or not. All operations that occur within the realm of a LabelSet can emit a vector of Metric entities to which the LabelSet may match.

func (LabelSet) Before

func (ls LabelSet) Before(o LabelSet) bool

Before compares the metrics, using the following criteria:

If m has fewer labels than o, it is before o. If it has more, it is not.

If the number of labels is the same, the superset of all label names is sorted alphanumerically. The first differing label pair found in that order determines the outcome: If the label does not exist at all in m, then m is before o, and vice versa. Otherwise the label value is compared alphanumerically.

If m and o are equal, the method returns false.

func (LabelSet) Clone

func (ls LabelSet) Clone() LabelSet

Clone returns a copy of the label set.

func (LabelSet) Equal

func (ls LabelSet) Equal(o LabelSet) bool

Equal returns true iff both label sets have exactly the same key/value pairs.

func (LabelSet) Merge

func (ls LabelSet) Merge(other LabelSet) LabelSet

Merge is a helper function to non-destructively merge two label sets.

func (LabelSet) String

func (ls LabelSet) String() string

func (*LabelSet) UnmarshalJSON

func (ls *LabelSet) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (LabelSet) Validate

func (ls LabelSet) Validate() error

Validate checks whether all names and values in the label set are valid.

type LabelValue

type LabelValue string

A LabelValue is an associated value for a LabelName.

func (LabelValue) IsValid

func (lv LabelValue) IsValid() bool

IsValid returns true iff the string is a valid UTF8.

type LabelValues

type LabelValues []LabelValue

LabelValues is a sortable LabelValue slice. It implements sort.Interface.

func (LabelValues) Len

func (l LabelValues) Len() int

func (LabelValues) Less

func (l LabelValues) Less(i, j int) bool

func (LabelValues) Swap

func (l LabelValues) Swap(i, j int)

type Time added in v0.8.0

type Time int64

Time is the number of milliseconds since the epoch (1970-01-01 00:00 UTC) excluding leap seconds.

func Now added in v0.8.0

func Now() Time

Now returns the current time as a Time.

func TimeFromUnix added in v0.8.0

func TimeFromUnix(t int64) Time

TimeFromUnix returns the Time equivalent to the Unix Time t provided in seconds.

func TimeFromUnixNano added in v0.8.0

func TimeFromUnixNano(t int64) Time

TimeFromUnixNano returns the Time equivalent to the Unix Time t provided in nanoseconds.

func (Time) Add added in v0.8.0

func (t Time) Add(d time.Duration) Time

Add returns the Time t + d.

func (Time) After added in v0.8.0

func (t Time) After(o Time) bool

After reports whether the Time t is after o.

func (Time) Before added in v0.8.0

func (t Time) Before(o Time) bool

Before reports whether the Time t is before o.

func (Time) Equal added in v0.8.0

func (t Time) Equal(o Time) bool

Equal reports whether two Times represent the same instant.

func (Time) MarshalJSON added in v0.8.0

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Time) String added in v0.8.0

func (t Time) String() string

String returns a string representation of the Time.

func (Time) Sub added in v0.8.0

func (t Time) Sub(o Time) time.Duration

Sub returns the Duration t - o.

func (Time) Time added in v0.8.0

func (t Time) Time() time.Time

Time returns the time.Time representation of t.

func (Time) Unix added in v0.8.0

func (t Time) Unix() int64

Unix returns t as a Unix time, the number of seconds elapsed since January 1, 1970 UTC.

func (Time) UnixNano added in v0.8.0

func (t Time) UnixNano() int64

UnixNano returns t as a Unix time, the number of nanoseconds elapsed since January 1, 1970 UTC.

func (*Time) UnmarshalJSON added in v0.8.0

func (t *Time) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

Jump to

Keyboard shortcuts

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