ckey

package
v0.0.0-...-3dd6856 Latest Latest
Warning

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

Go to latest
Published: May 20, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(a, b ContextKey) int

Compare returns an integer comparing two strings lexicographically. The result will be 0 if a==b, -1 if a < b, and +1 if a > b.

Types

type ContextKey

type ContextKey [byteSize]byte

ContextKey is a non-cryptographic hash that allows to aggregate metrics from a same context together.

This implementation has been designed to remove all heap allocations from the intake to reduce GC pressure on high volumes.

It uses the 128bit murmur3 hash, that is already successfully used on other products. 128bit is probably overkill for avoiding collisions, but it's better to err on the safe side, as we do not have a collision mitigation mechanism.

func Generate

func Generate(name, hostname string, tags []string) ContextKey

Generate returns the ContextKey hash for the given parameters. The tags array is sorted in place to avoid heap allocations.

func Parse

func Parse(src string) (ContextKey, error)

Parse returns a ContextKey instanciated with the value decoded as hexa

func (ContextKey) IsZero

func (k ContextKey) IsZero() bool

IsZero returns true if the key is at zero value

func (ContextKey) String

func (k ContextKey) String() string

String returns the hexadecimal representation of the key

Jump to

Keyboard shortcuts

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