utils

package
v0.0.0-...-1d9613f Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConcatenateTags

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

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

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 Expire

type Expire struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Expire implements a simple last-seen-time-based expiry logic for watching for disappearing entities (for triggering events or just cache housekeeping). User classes define an expiry delay, then call Update every time they encounter a given entity. ComputeExpires() returns the entity names that have not been seen for longer than the configured delay. As Expire keeps an internal state of entity names, Update will return true if a name is new, false otherwise.

func NewExpire

func NewExpire(expiryDuration time.Duration) (*Expire, error)

NewExpire creates a new Expire object. Called when a Collector is started. Only used for the ECS collector to start with.

func (*Expire) ComputeExpires

func (e *Expire) ComputeExpires() ([]string, error)

ComputeExpires should be called right after an Update.

func (*Expire) Update

func (e *Expire) Update(container string, ts time.Time) bool

Update the map of the Expire obect.

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) Compute

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

Compute returns two string arrays in the format "tag:value" first array is low cardinality tags, second is high card ones

Jump to

Keyboard shortcuts

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