Documentation ¶
Overview ¶
Package labels ... Copyright 2019 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Accumulate ¶
func Accumulate(dst, src Set)
Accumulate copies the labels of the source label Set into the destination.
func AccumulateOnly ¶
func AccumulateOnly(dst, src, attrs Set)
AccumulateOnly copies the labels from the source set into the destination, but only those that are present in the attrs set
Types ¶
type InfoSource ¶
InfoSource represents a prometheus info metric, those are pseudo-metrics that provide metadata in the form of labels.
type Set ¶
type Set map[string]interface{}
Set structure implemented as a map.
func DifferenceEqualValues ¶
DifferenceEqualValues does:
- Get all the labels that have are in both A and B label sets
- If those labels have the same values in both A and B, returns the difference A - B of label-values and "true"
- Otherwise, returns nil and false
- If there is no intersection in the label names, returns A and true
func Join ¶
Join returns the labels from src that should be added to dst if the label names in criteria coincide. If criteria is empty, returns src The function ignores the values in criteria
func ToAdd ¶
func ToAdd(infos []InfoSource, dst Set) Set
ToAdd decide which labels should be added, a set of _info metrics, to the destination label set. It does, for each info: - if DifferenceEqualValues(info, b) == x, true:
- suffixes info.Name to all x label names and adds it to the result
- If info1.Name == info2.Name AND DifferenceEqualValues(info1, b) == x, true and DifferenceEqualValues(info1, b) == y, true:
- no metrics neither from info1.Name nor info2.Name are added to the result