Documentation
¶
Index ¶
- Variables
- func ComponentTargetsToPromTargetGroups(jobName string, tgs []Target) map[string][]*targetgroup.Group
- func NewFromConvertibleConfig[T ConvertibleConfig](opts component.Options, conf T) (component.Component, error)
- type Component
- type ConvertibleConfig
- type Creator
- type DiscovererConfig
- type DiscovererWithMetrics
- type DistributedTargets
- type Exports
- type Target
- func (t Target) AlloyCapsule()
- func (t Target) AsMap() map[string]string
- func (t *Target) ConvertFrom(src interface{}) error
- func (t Target) ConvertInto(dst interface{}) error
- func (t Target) Equals(other any) bool
- func (t Target) EqualsTarget(other *Target) bool
- func (t Target) ForEachLabel(f func(key string, value string) bool) bool
- func (t Target) Get(key string) (string, bool)
- func (t Target) HashLabelsWithPredicate(pred func(key string) bool) uint64
- func (t Target) LabelSet() commonlabels.LabelSet
- func (t Target) Len() int
- func (t Target) NonMetaLabelsHash() uint64
- func (t Target) NonReservedLabelSet() commonlabels.LabelSet
- func (t Target) PromLabels() modellabels.Labels
- func (t Target) SpecificLabelsHash(labelNames []string) uint64
- func (t Target) String() string
- type TargetBuilder
Constants ¶
This section is empty.
Variables ¶
var EmptyTarget = Target{ // contains filtered or unexported fields }
var MaxUpdateFrequency = 5 * time.Second
MaxUpdateFrequency is the minimum time to wait between updating targets. Prometheus uses a static threshold. Do not recommend changing this, except for tests.
Functions ¶
func ComponentTargetsToPromTargetGroups ¶ added in v1.7.0
func ComponentTargetsToPromTargetGroups(jobName string, tgs []Target) map[string][]*targetgroup.Group
func NewFromConvertibleConfig ¶ added in v1.2.0
func NewFromConvertibleConfig[T ConvertibleConfig](opts component.Options, conf T) (component.Component, error)
NewFromConvertibleConfig creates a discovery component given a ConvertibleConfig. Convenience function for New.
Types ¶
type Component ¶
type Component struct {
// contains filtered or unexported fields
}
Component is a reusable component for any discovery implementation. it will handle dynamic updates and exporting targets appropriately for a scrape implementation.
func New ¶
New creates a discovery component given arguments and a concrete Discovery implementation function.
func (*Component) LiveDebugging ¶ added in v1.6.0
type ConvertibleConfig ¶ added in v1.2.0
type ConvertibleConfig interface { // Convert converts the struct into a DiscovererConfig. Convert() DiscovererConfig }
ConvertibleConfig is used to more conveniently convert a configuration struct into a DiscovererConfig.
type Creator ¶
type Creator func(component.Arguments) (DiscovererConfig, error)
Creator is a function provided by an implementation to create a concrete DiscovererConfig instance.
type DiscovererConfig ¶ added in v1.2.0
DiscovererConfig is an alias for Prometheus' DiscovererConfig interface, so users of this package don't need to import github.com/prometheus/prometheus/discover as well.
type DiscovererWithMetrics ¶ added in v1.2.0
type DiscovererWithMetrics interface { promdiscovery.Discoverer promdiscovery.DiscovererMetrics }
func NewDiscovererWithMetrics ¶ added in v1.2.0
func NewDiscovererWithMetrics(cfg promdiscovery.Config, reg prometheus.Registerer, logger log.Logger) (DiscovererWithMetrics, error)
type DistributedTargets ¶
type DistributedTargets struct {
// contains filtered or unexported fields
}
DistributedTargets uses the node's Lookup method to distribute discovery targets when a component runs in a cluster.
func NewDistributedTargets ¶
func NewDistributedTargets(clusteringEnabled bool, cluster cluster.Cluster, allTargets []Target) *DistributedTargets
NewDistributedTargets creates the abstraction that allows components to dynamically shard targets between components.
func NewDistributedTargetsWithCustomLabels ¶ added in v1.4.2
func NewDistributedTargetsWithCustomLabels(clusteringEnabled bool, cluster cluster.Cluster, allTargets []Target, labels []string) *DistributedTargets
NewDistributedTargetsWithCustomLabels creates the abstraction that allows components to dynamically shard targets between components. Passing in labels will limit the sharding to only use those labels for computing the hash key. Passing in nil or empty array means look at all labels.
func (*DistributedTargets) LocalTargets ¶ added in v1.2.0
func (dt *DistributedTargets) LocalTargets() []Target
LocalTargets returns the targets that belong to the local cluster node.
func (*DistributedTargets) MovedToRemoteInstance ¶ added in v1.2.0
func (dt *DistributedTargets) MovedToRemoteInstance(prev *DistributedTargets) []Target
MovedToRemoteInstance returns the set of local targets from prev that are no longer local in dt, indicating an active target has moved. Only targets which exist in both prev and dt are returned. If prev contains an empty list of targets, no targets are returned.
func (*DistributedTargets) TargetCount ¶ added in v1.4.2
func (dt *DistributedTargets) TargetCount() int
type Exports ¶
type Exports struct {
Targets []Target `alloy:"targets,attr"`
}
Exports holds values which are exported by all discovery components.
type Target ¶
type Target struct {
// contains filtered or unexported fields
}
func NewTargetFromLabelSet ¶ added in v1.7.0
func NewTargetFromLabelSet(ls commonlabels.LabelSet) Target
func NewTargetFromMap ¶ added in v1.7.0
func NewTargetFromModelLabels ¶ added in v1.7.0
func NewTargetFromModelLabels(labels modellabels.Labels) Target
NewTargetFromModelLabels creates a target from model Labels. NOTE: this is not optimised and should be avoided on a hot path.
func NewTargetFromSpecificAndBaseLabelSet ¶ added in v1.7.0
func NewTargetFromSpecificAndBaseLabelSet(own, group commonlabels.LabelSet) Target
func (Target) AlloyCapsule ¶ added in v1.7.0
func (t Target) AlloyCapsule()
AlloyCapsule marks FastTarget as a capsule so Alloy syntax can marshal to or from it.
func (Target) AsMap ¶ added in v1.7.0
AsMap returns target's labels as a map of strings. Deprecated: this should not be used on any hot path as it leads to more allocation.
func (*Target) ConvertFrom ¶ added in v1.7.0
ConvertFrom is called by Alloy syntax to try converting from another type to Target.
func (Target) ConvertInto ¶ added in v1.7.0
ConvertInto is called by Alloy syntax to try converting Target to another type.
func (Target) Equals ¶ added in v1.7.0
Equals implements equality.CustomEquality. Works only with pointers.
func (Target) EqualsTarget ¶ added in v1.7.0
func (Target) ForEachLabel ¶ added in v1.7.0
ForEachLabel runs f over each key value pair in the Target. f must not modify Target while iterating. If f returns false, the iteration is interrupted. If f returns true, the iteration continues until the last element. ForEachLabel returns true if all the labels were iterated over or false if any call to f has interrupted the iteration. ForEachLabel does not guarantee iteration order or sort labels in any way.
func (Target) HashLabelsWithPredicate ¶ added in v1.7.0
func (Target) LabelSet ¶ added in v1.7.0
func (t Target) LabelSet() commonlabels.LabelSet
LabelSet converts this target in to a LabelSet Deprecated: this is not optimised and should be avoided if possible.
func (Target) NonMetaLabelsHash ¶ added in v1.7.0
func (Target) NonReservedLabelSet ¶ added in v1.7.0
func (t Target) NonReservedLabelSet() commonlabels.LabelSet
func (Target) PromLabels ¶ added in v1.7.0
func (t Target) PromLabels() modellabels.Labels
PromLabels converts this target into prometheus/prometheus/model/labels.Labels. It is not efficient and should be avoided on a hot path.
func (Target) SpecificLabelsHash ¶ added in v1.7.0
type TargetBuilder ¶ added in v1.7.0
type TargetBuilder interface { relabel.LabelBuilder Target() Target MergeWith(Target) TargetBuilder }
func NewTargetBuilder ¶ added in v1.7.0
func NewTargetBuilder() TargetBuilder
NewTargetBuilder creates an empty labels builder.
func NewTargetBuilderFrom ¶ added in v1.7.0
func NewTargetBuilderFrom(t Target) TargetBuilder
func NewTargetBuilderFromLabelSets ¶ added in v1.7.0
func NewTargetBuilderFromLabelSets(group, own commonlabels.LabelSet) TargetBuilder
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package docker implements the discovery.docker component.
|
Package docker implements the discovery.docker component. |
Package gce implements the discovery.gce component.
|
Package gce implements the discovery.gce component. |
Package kubelet implements a discovery.kubelet component.
|
Package kubelet implements a discovery.kubelet component. |
Package kubernetes implements a discovery.kubernetes component.
|
Package kubernetes implements a discovery.kubernetes component. |