utils

package
v0.0.0-...-c4caace Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMetadataAsTags

func AddMetadataAsTags(name, value string, metadataAsTags map[string]string, glob map[string]glob.Glob, tags *TagList)

AddMetadataAsTags converts name and value into tags based on the metadata as tags configuration and patterns

func ComputeTagsHash

func ComputeTagsHash(tags []string) string

ComputeTagsHash returns a hash of the supplied tags.

func ConcatenateTags

func ConcatenateTags(slices [][]string) []string

ConcatenateTags is a fast way to concatenate multiple tag arrays in a single one.

func InitMetadataAsTags

func InitMetadataAsTags(metadataAsTags map[string]string) (map[string]string, map[string]glob.Glob)

InitMetadataAsTags prepares labels and annotations as tags - It lower-case all the labels in metadataAsTags - It compiles all the patterns and stores them in a map of glob.Glob objects

func StringInRuneset

func StringInRuneset(name, subset string) bool

StringInRuneset tests whether all runes of a string are in a given subset returns false if any rune in the string is not found in the subset

Types

type TagList

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

TagList allows collector to incremental build a tag list then export it easily to []string format

func NewTagList

func NewTagList() *TagList

NewTagList creates a new object ready to use

func (*TagList) AddAuto

func (l *TagList) AddAuto(name, value string)

AddAuto determine the tag cardinality and will call the proper method AddLow or AddHigh if the name value starts with '+' character

func (*TagList) AddHigh

func (l *TagList) AddHigh(name string, value string)

AddHigh adds a new high cardinality tag to the map, or replace if already exists. It will skip empty values/names, so it's safe to use without verifying the value is not empty.

func (*TagList) AddLow

func (l *TagList) AddLow(name string, value string)

AddLow adds a new low cardinality tag to the list, or replace if already exists. It will skip empty values/names, so it's safe to use without verifying the value is not empty.

func (*TagList) AddOrchestrator

func (l *TagList) AddOrchestrator(name string, value string)

AddOrchestrator adds a new orchestrator-level cardinality tag to the map, or replice if already exists. It will skip empty values/names, so it's safe to use without verifying the value is not empty.

func (*TagList) AddStandard

func (l *TagList) AddStandard(name string, value string)

AddStandard adds a new standard tag to the list, or replace if already exists. It adds the standard tag to the low cardinality tag list as well. It will skip empty values/names, so it's safe to use without verifying the value is not empty.

func (*TagList) Compute

func (l *TagList) Compute() ([]string, []string, []string, []string)

Compute returns four string arrays in the format "tag:value" - low cardinality - orchestrator cardinality - high cardinality - standard tags

func (*TagList) Copy

func (l *TagList) Copy() *TagList

Copy creates a deep copy of the taglist object for reuse

Jump to

Keyboard shortcuts

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