Documentation
¶
Index ¶
- type DynamicLabeler
- type DynamicLabelerConfig
- type KubeNode
- func (k *KubeNode) Annotation(key string) (string, bool)
- func (k *KubeNode) Close() error
- func (k *KubeNode) Label(key string) (string, bool)
- func (k *KubeNode) Open(ctx context.Context) error
- func (k *KubeNode) WalkAnnotations(fn func(key, value string))
- func (k *KubeNode) WalkLabels(fn func(key, value string))
- type LogLabeler
- type MetricLabeler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DynamicLabeler ¶
type DynamicLabeler struct {
// contains filtered or unexported fields
}
DynamicLabeler is a labeler that adds dynamic labels from a collection of metadata sources.
func FromConfig ¶
func FromConfig(kubeNode *KubeNode, cfg *DynamicLabelerConfig) *DynamicLabeler
FromConfig creates a DynamicLabeler from the provided configuration and metadata sources. The provided configuration may be nil.
func (*DynamicLabeler) AppendLabelNamesBytes ¶
func (d *DynamicLabeler) AppendLabelNamesBytes(names [][]byte) [][]byte
AppendLabelNamesBytes appends the dynamic label names this labeler sets to the provided slice of labels.
func (*DynamicLabeler) AppendPromLabels ¶
func (d *DynamicLabeler) AppendPromLabels(ts *prompb.TimeSeries)
func (*DynamicLabeler) SetResourceValues ¶
func (d *DynamicLabeler) SetResourceValues(log *types.Log)
func (*DynamicLabeler) WalkLabels ¶
func (d *DynamicLabeler) WalkLabels(callback func(key, value []byte))
WalkLabels calls the provided function for each dynamic label this labeler would add. If the label source does not have a value for the label, the value will be an empty string.
type DynamicLabelerConfig ¶
type DynamicLabelerConfig struct {
KubernetesNodeLabels map[string]string
KubernetesNodeAnnotations map[string]string
}
DynamicLabelerConfig contains the label mapping configuration used to build a DynamicLabeler.
type KubeNode ¶
type KubeNode struct {
// contains filtered or unexported fields
}
KubeNode watches metadata for the local Kubernetes node and exposes its labels and annotations in a concurrency-safe manner. The watcher implements the service.Component interface via the Open and Close methods so it can be managed alongside other long-lived components in the collector.
func NewKubeNode ¶
func NewKubeNode(client kubernetes.Interface, nodeName string) *KubeNode
NewKubeNode creates a new KubeNode watcher for the provided node name.
func (*KubeNode) Annotation ¶
Annotation returns the value of an annotation on the current node along with a boolean indicating whether the key was present.
func (*KubeNode) Label ¶
Label returns the value of a label on the current node along with a boolean indicating whether the key was present.
func (*KubeNode) Open ¶
Open initializes the node informer and blocks until the initial metadata for the local node has been observed or the timeout is reached. Subsequent calls are no-ops. If the initial sync fails or times out, no error is returned to allow the collector to continue starting up; metadata will be populated asynchronously once events arrive.
func (*KubeNode) WalkAnnotations ¶
WalkAnnotations calls the provided function for each annotation on the node.
func (*KubeNode) WalkLabels ¶
WalkLabels calls the provided function for each label on the node.
type LogLabeler ¶
type MetricLabeler ¶
type MetricLabeler interface {
// AppendLabelNamesBytes appends the dynamic label names this labeler sets to the provided slice of labels.
AppendLabelNamesBytes(names [][]byte) [][]byte
// WalkLabels calls the provided function for each dynamic label this labeler would add.
// If the label source does not have a value for the label, the value will be an empty slice.
WalkLabels(callback func(key, value []byte))
// AppendPromLabels appends the dynamic labels this labeler sets to the provided TimeSeries.
AppendPromLabels(ts *prompb.TimeSeries)
}
MetricLabeler is a labeler that adds dynamic labels from a collection of metadata sources. Intended for usage with the metrics path of the collector.