retrieval

package
v0.0.0-...-50fdf0b Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2018 License: Apache-2.0 Imports: 33 Imported by: 4

Documentation

Overview

Copyright 2018 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2018 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	NoTimestamp = 0
)
View Source
const SeparatorByte byte = 255

SeparatorByte is a byte that cannot occur in valid UTF-8 sequences and is used to separate label names, label values, and other strings from each other when calculating their combined hash value (aka signature aka fingerprint).

Variables

View Source
var (
	ErrNotFound                    = errors.New("not found")
	ErrOutOfOrderSample            = errors.New("out of order sample")
	ErrDuplicateSampleForTimestamp = errors.New("duplicate sample for timestamp")
	ErrOutOfBounds                 = errors.New("out of bounds")
)

The errors exposed.

Functions

func LabelPairsToLabels

func LabelPairsToLabels(input []*dto.LabelPair) (output labels.Labels)

func LabelsToLabelPairs

func LabelsToLabelPairs(lset labels.Labels) []*dto.LabelPair

func ResetPointCompatible

func ResetPointCompatible(mType dto.MetricType) bool

Types

type Appendable

type Appendable interface {
	Appender() (Appender, error)
}

Appendable returns an Appender.

type Appender

type Appender interface {
	Add(metricFamily *MetricFamily) error
}

type LabelPairsByName

type LabelPairsByName []*dto.LabelPair

LabelPairsByName implements sort.Interface for []*MetricFamily based on the Name field.

func (LabelPairsByName) Len

func (f LabelPairsByName) Len() int

func (LabelPairsByName) Less

func (f LabelPairsByName) Less(i, j int) bool

func (LabelPairsByName) Swap

func (f LabelPairsByName) Swap(i, j int)

type MetricFamily

type MetricFamily struct {
	*dto.MetricFamily
	// MetricResetTimestampMs must have one element for each
	// MetricFamily.Metric. Elements must be initialized to NoTimestamp if
	// the value is unknown.
	MetricResetTimestampMs []int64
	// see Target.DiscoveredLabels()
	TargetLabels labels.Labels
	// contains filtered or unexported fields
}

func NewMetricFamily

func NewMetricFamily(pb *dto.MetricFamily, metricResetTimestampMs []int64, targetLabels labels.Labels) (*MetricFamily, error)

func (*MetricFamily) Fingerprint

func (f *MetricFamily) Fingerprint() uint64

func (*MetricFamily) Slice

func (f *MetricFamily) Slice(i int) *MetricFamily

func (*MetricFamily) String

func (f *MetricFamily) String() string

type Point

type Point struct {
	Timestamp  time.Time
	ResetValue *PointValue
	LastValue  *PointValue
}

type PointHistogram

type PointHistogram struct {
	Count  uint64
	Sum    float64
	Bucket []PointHistogramBucket
}

type PointHistogramBucket

type PointHistogramBucket struct {
	CumulativeCount uint64
	UpperBound      float64
}

type PointSummary

type PointSummary struct {
	Count uint64
	Sum   float64
}

type PointValue

type PointValue struct {
	// Only one of the following fields may be set.
	Counter   float64
	Histogram PointHistogram
	Summary   PointSummary
}

type ResetPointKey

type ResetPointKey uint64

func NewResetPointKey

func NewResetPointKey(metricName string, metricLabels labels.Labels, metricType dto.MetricType) (key ResetPointKey)

type ScrapeManager

type ScrapeManager struct {
	// contains filtered or unexported fields
}

ScrapeManager maintains a set of scrape pools and manages start/stop cycles when receiving new target groups form the discovery manager.

func NewScrapeManager

func NewScrapeManager(logger log.Logger, app Appendable) *ScrapeManager

NewScrapeManager is the ScrapeManager constructor

func (*ScrapeManager) ApplyConfig

func (m *ScrapeManager) ApplyConfig(cfg *config.Config) error

ApplyConfig resets the manager's target providers and job configurations as defined by the new cfg.

func (*ScrapeManager) Run

func (m *ScrapeManager) Run(tsets <-chan map[string][]*targetgroup.Group) error

Run starts background processing to handle target updates and reload the scraping loops.

func (*ScrapeManager) Stop

func (m *ScrapeManager) Stop()

Stop cancels all running scrape pools and blocks until all have exited.

func (*ScrapeManager) TargetMap

func (m *ScrapeManager) TargetMap() map[string][]*Target

TargetMap returns map of active and dropped targets and their corresponding scrape config job name.

func (*ScrapeManager) Targets

func (m *ScrapeManager) Targets() []*Target

Targets returns the targets currently being scraped.

type Target

type Target struct {
	// contains filtered or unexported fields
}

Target refers to a singular HTTP or HTTPS endpoint.

func NewTarget

func NewTarget(labels, discoveredLabels labels.Labels, params url.Values) *Target

NewTarget creates a reasonably configured target for querying.

func (*Target) AddResetPoint

func (t *Target) AddResetPoint(key ResetPointKey, point Point)

func (*Target) DiscoveredLabels

func (t *Target) DiscoveredLabels() labels.Labels

DiscoveredLabels returns a copy of the target's labels before any processing.

func (*Target) GetResetPoint

func (t *Target) GetResetPoint(key ResetPointKey) (point *Point)

func (*Target) HasResetPoints

func (t *Target) HasResetPoints() bool

func (*Target) Health

func (t *Target) Health() TargetHealth

Health returns the last known health state of the target.

func (*Target) Labels

func (t *Target) Labels() labels.Labels

Labels returns a copy of the set of all public labels of the target.

func (*Target) LastError

func (t *Target) LastError() error

LastError returns the error encountered during the last scrape.

func (*Target) LastScrape

func (t *Target) LastScrape() time.Time

LastScrape returns the time of the last scrape.

func (*Target) String

func (t *Target) String() string

func (*Target) SuccessfullyScraped

func (t *Target) SuccessfullyScraped() bool

SuccessfullyScraped returns whether there has been a successful scrape. This function will return true even if there have been failed scrapes, as long as there has been at least one successful one.

func (*Target) URL

func (t *Target) URL() *url.URL

URL returns a copy of the target's URL.

type TargetHealth

type TargetHealth string

TargetHealth describes the health state of a target.

const (
	HealthUnknown TargetHealth = "unknown"
	HealthGood    TargetHealth = "up"
	HealthBad     TargetHealth = "down"
)

The possible health states of a target based on the last performed scrape.

type Targets

type Targets []*Target

Targets is a sortable list of targets.

func (Targets) Len

func (ts Targets) Len() int

func (Targets) Less

func (ts Targets) Less(i, j int) bool

func (Targets) Swap

func (ts Targets) Swap(i, j int)

Jump to

Keyboard shortcuts

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