labels

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: Apache-2.0 Imports: 0 Imported by: 0

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

type InfoSource struct {
	Name   string
	Labels Set
}

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

func DifferenceEqualValues(a, b Set) (Set, bool)

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

func Join(src, dst, criteria Set) (Set, bool)

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

Jump to

Keyboard shortcuts

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