Documentation
¶
Index ¶
- func LabelsToMetric(ls []prompb.Label) model.Metric
- func MetricNameFromLabels(labels []prompb2.Label) string
- type Overrides
- func (o *Overrides) CreationGracePeriod(userID string) time.Duration
- func (o *Overrides) EnforceMetadataMetricName(userID string) bool
- func (o *Overrides) EnforceMetricName(userID string) bool
- func (o *Overrides) MaxLabelNameLength(userID string) int
- func (o *Overrides) MaxLabelNamesPerSeries(userID string) int
- func (o *Overrides) MaxLabelValueLength(userID string) int
- func (o *Overrides) MaxMetadataLength(userID string) int
- func (o *Overrides) MaxQueryLength(userID string) time.Duration
- func (o *Overrides) PromLimitEnabled(userID string) bool
- func (o *Overrides) RejectOldSamples(userID string) bool
- func (o *Overrides) RejectOldSamplesMaxAge(userID string) time.Duration
- type TenantLimits
- type ValidationError
- func ValidateLabels(userID string, ls []prompb2.Label, unsafeMetricName string) ValidationError
- func ValidateMetadata(userID string, metadata *prompb.MetricMetadata) ValidationError
- func ValidateQueryTimeRange(userID string, startTime, endTime time.Time) ValidationError
- func ValidateSample(userID string, metricName string, s prompb2.Sample) ValidationError
- func ValidateSeries(userID string, ts *prompb2.TimeSeries) ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LabelsToMetric ¶
LabelsToMetric converts a Labels to Metric Don't do this on any performance sensitive paths.
func MetricNameFromLabels ¶
MetricNameFromLabels extracts the metric name from a list of LabelPairs. The returned metric name string is a reference to the label value (no copy).
Types ¶
type Overrides ¶
type Overrides struct {
// contains filtered or unexported fields
}
Overrides periodically fetch a set of per-user overrides, and provides convenience functions for fetching the correct value.
func InitOverrides ¶
func InitOverrides(defaults config.Limits, tenantLimits TenantLimits) *Overrides
InitOverrides makes a new global Overrides.
func (*Overrides) CreationGracePeriod ¶
CreationGracePeriod is misnamed, and actually returns how far into the future we should accept samples.
func (*Overrides) EnforceMetadataMetricName ¶
EnforceMetadataMetricName whether to enforce the presence of a metric name on metadata.
func (*Overrides) EnforceMetricName ¶
EnforceMetricName whether to enforce the presence of a metric name.
func (*Overrides) MaxLabelNameLength ¶
MaxLabelNameLength returns maximum length a label name can be.
func (*Overrides) MaxLabelNamesPerSeries ¶
MaxLabelNamesPerSeries returns maximum number of label/value pairs timeseries.
func (*Overrides) MaxLabelValueLength ¶
MaxLabelValueLength returns maximum length a label value can be. This also is the maximum length of a metric name.
func (*Overrides) MaxMetadataLength ¶
MaxMetadataLength returns maximum length metadata can be. Metadata refers to the Metric Name, HELP and UNIT.
func (*Overrides) MaxQueryLength ¶
MaxQueryLength returns the limit of the length (in time) of a query.
func (*Overrides) PromLimitEnabled ¶
func (*Overrides) RejectOldSamples ¶
RejectOldSamples returns true when we should reject samples older than certain age.
type TenantLimits ¶
type TenantLimits interface {
// ByUserID gets limits specific to a particular tenant or nil if there are none
ByUserID(userID string) *config.Limits
// AllByUserID gets a mapping of all tenant IDs and limits for that user
AllByUserID() map[string]*config.Limits
}
TenantLimits exposes per-tenant limit overrides to various resource usage limits
type ValidationError ¶
type ValidationError error
ValidationError is an error returned by series validation.
nolint:golint ignore stutter warning
func ValidateLabels ¶
func ValidateLabels(userID string, ls []prompb2.Label, unsafeMetricName string) ValidationError
ValidateLabels returns an err if the labels are invalid. The returned error may retain the provided series labels.
func ValidateMetadata ¶
func ValidateMetadata(userID string, metadata *prompb.MetricMetadata) ValidationError
ValidateMetadata returns an err if a metric metadata is invalid.
func ValidateQueryTimeRange ¶
func ValidateQueryTimeRange(userID string, startTime, endTime time.Time) ValidationError
validate query time range.
func ValidateSample ¶
func ValidateSample(userID string, metricName string, s prompb2.Sample) ValidationError
ValidateSample returns an err if the sample is invalid. The returned error may retain the provided series labels.
func ValidateSeries ¶
func ValidateSeries(userID string, ts *prompb2.TimeSeries) ValidationError
Validates a single series from a write request.